Difference between revisions of "Fedora 21 Server"

From FOG Project
Jump to: navigation, search
Line 1: Line 1:
 
Currently Under Construction!
 
Currently Under Construction!
 
Expect an amazing article soon!
 
Expect an amazing article soon!
Last modified: April 10th, 2015.
+
Last modified: 7-23-2015.
 +
 
 +
 
 +
= Installing Fedora 21 server =
 +
 
 +
== Configuring partitions for FOG ==
 +
 
 +
The one thing with using Fedora (or any red-hat based distro) is that the default partitioning isn't optimal for FOG. The default is that "root" only gets 50 GiB and the rest goes to /home. This is not optimal. The most simple partitioning setup for FOG is below:
 +
 
 +
*Give "swap" the same amount as the amount of RAM the system has.
 +
 
 +
*Give "home" just a little for working space.. like 5 gigs.
 +
 
 +
*Give the "boot" partition about 2 gigs to be future proof.
 +
 
 +
*Finally, give the rest to "/" (root).
 +
 
 +
Fedora (and most red-hat installers) auto-adjust partition sizes for you if you go over what is available... meaning.. if you are unsure about how much space is left on the drive to assign to "/", and you have a 500GB drive, you can just type something absurd in like 999 GiB and hit "update" and the installer will auto adjust that amount to what is available.
 +
 
 +
 
 +
== Continue installation ==
 +
 
 +
*Under network settings, set a static IP and a name. DNS entries are comma delimited (no spaces).
 +
 
 +
*Set the timezone.
 +
 
 +
*Start installing
 +
 
 +
*Set a root password.
 +
 
 +
 
 +
= Fedora 21 server pre-config =
 +
 
 +
 
 +
== Update Fedora 21 server ==
 +
 
 +
Update everything installed with this line:
 +
 
 +
<pre>yum update -y</pre>
 +
 
 +
== Continue pre-config ==
 +
 
 +
After installation is complete and reboot is done, you can work through putty from this point forward. You can get a copy [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html here].
 +
 
 +
*Log in as root with the password you set earlier.
 +
 
 +
*Disable the firewall now and on boot:
 +
 
 +
<pre>systemctl stop firewalld
 +
systemctl disable firewalld</pre>
 +
 
 +
*Disable SELinux on boot by editing /etc/selinux/config
 +
 
 +
<pre>vi /etc/selinux/config</pre>
 +
 
 +
Instructions on using Vi: [[Vi]]
 +
 
 +
Change the line <pre>SELINUX=enforcing</pre>
 +
 
 +
to
 +
 
 +
<pre>SELINUX=disabled</pre>
 +
 
 +
*Stop SELinux from running with
 +
 
 +
<pre>setenforce 0</pre>
 +
 
 +
== Install MySQL ==
 +
 
 +
Fedora 21 Server currently needs mysql installed before the latest FOG Trunk is installed.
 +
 
 +
Do that with this line:
 +
 
 +
<pre>yum install -y mysql mysql-server</pre>
 +
 
 +
 
 +
= Setup FOG Trunk =
 +
 
 +
This will install the latest developmental version of FOG using the Subversion method found here: [[SVN]]
 +
 
 +
 
 +
 
 +
<pre>yum install -y subversion
 +
cd ~
 +
mkdir svn
 +
cd svn
 +
svn checkout https://svn.code.sf.net/p/freeghost/code/trunk
 +
cd trunk/bin
 +
./installfog.sh</pre>
 +
 
 +
*Follow the on-screen instructions to setup fog for your environment. If you are unsure about anything, choose the default option.
 +
 
 +
 
 +
 
 +
 
 +
= Post Config =
 +
 
 +
== Verify DHCP config (if using DHCP) ==
 +
 
 +
If you chose to install FOG with DHCP,
 +
the configuration file is (On a typical red-hat install) located here:  /etc/dhcp/dhcpd.conf
 +
 
 +
You can edit it using this command:
 +
 
 +
<pre>vi /etc/dhcp/dhcpd.conf</pre>
 +
 
 +
Instructions on using Vi: [[Vi]]
 +
 
 +
Things you might want to verify in this file is the range of IPs you want to give out, the network address, the subnet mask, and the bootfile you want to use. The default is set to undionly.kpxe and this works with most newer computers. Older computers (and especially Lenovos) should use undionly.kkpxe
 +
 
 +
To find your network address, you'd type:
 +
 
 +
 
 +
 
 +
=='''Set the FOG services to start 30 seconds after boot''' ==
 +
 
 +
(necessary with Fedora 21 & r2922 and up. There's an issue with the FOGMulticastManager after a reboot; it's timing related.)
 +
 
 +
 
 +
*Disable FOG services with:
 +
 
 +
<pre>systemctl disable FOG{MulticastManager,Scheduler,SnapinReplicator,ImageReplicator}</pre>
 +
 
 +
Create a startup script with:
 +
 
 +
<pre>vi /etc/rc.d/rc.local</pre>
 +
 
 +
Instructions on using Vi: [[Vi]]
 +
 
 +
*Make that file look like below, exactly. This creates a 30 second delay for starting these services at boot.
 +
 
 +
<pre>#!/bin/bash
 +
sleep 30
 +
systemctl start FOGMulticastManager
 +
systemctl start FOGScheduler
 +
systemctl start FOGSnapinReplicator
 +
systemctl start FOGImageReplicator
 +
exit 0</pre>
 +
 
 +
*save the file
 +
 
 +
*Then Run this command to make that file executable:
 +
 
 +
<pre>chmod +x /etc/rc.d/rc.local</pre>
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
  
Notes... Fedora 21 server does not have a GUI.
 
This guide, however, will guide you through installing FOG totally (with various setups).
 
  
  
  
lets see...
 
  
  
READ FIRST, COMPLETE FIRST ---Prerequisites CHECKLIST... Choosing a password for FOG user and root. Deciding where images will be stored. Full FOG DHCP or ProxyDHCP ?
 
  
  
  
  
== Installing Fedora 21 server ==
 
  
  

Revision as of 13:04, 10 July 2015

Currently Under Construction! Expect an amazing article soon! Last modified: 7-23-2015.


Installing Fedora 21 server

Configuring partitions for FOG

The one thing with using Fedora (or any red-hat based distro) is that the default partitioning isn't optimal for FOG. The default is that "root" only gets 50 GiB and the rest goes to /home. This is not optimal. The most simple partitioning setup for FOG is below:

  • Give "swap" the same amount as the amount of RAM the system has.
  • Give "home" just a little for working space.. like 5 gigs.
  • Give the "boot" partition about 2 gigs to be future proof.
  • Finally, give the rest to "/" (root).

Fedora (and most red-hat installers) auto-adjust partition sizes for you if you go over what is available... meaning.. if you are unsure about how much space is left on the drive to assign to "/", and you have a 500GB drive, you can just type something absurd in like 999 GiB and hit "update" and the installer will auto adjust that amount to what is available.


Continue installation

  • Under network settings, set a static IP and a name. DNS entries are comma delimited (no spaces).
  • Set the timezone.
  • Start installing
  • Set a root password.


Fedora 21 server pre-config

Update Fedora 21 server

Update everything installed with this line:

yum update -y

Continue pre-config

After installation is complete and reboot is done, you can work through putty from this point forward. You can get a copy here.

  • Log in as root with the password you set earlier.
  • Disable the firewall now and on boot:
systemctl stop firewalld
systemctl disable firewalld
  • Disable SELinux on boot by editing /etc/selinux/config
vi /etc/selinux/config

Instructions on using Vi: Vi

Change the line
SELINUX=enforcing

to

SELINUX=disabled
  • Stop SELinux from running with
setenforce 0

Install MySQL

Fedora 21 Server currently needs mysql installed before the latest FOG Trunk is installed.

Do that with this line:

yum install -y mysql mysql-server


Setup FOG Trunk

This will install the latest developmental version of FOG using the Subversion method found here: SVN


yum install -y subversion
cd ~
mkdir svn
cd svn
svn checkout https://svn.code.sf.net/p/freeghost/code/trunk
cd trunk/bin
./installfog.sh
  • Follow the on-screen instructions to setup fog for your environment. If you are unsure about anything, choose the default option.



Post Config

Verify DHCP config (if using DHCP)

If you chose to install FOG with DHCP, the configuration file is (On a typical red-hat install) located here: /etc/dhcp/dhcpd.conf

You can edit it using this command:

vi /etc/dhcp/dhcpd.conf

Instructions on using Vi: Vi

Things you might want to verify in this file is the range of IPs you want to give out, the network address, the subnet mask, and the bootfile you want to use. The default is set to undionly.kpxe and this works with most newer computers. Older computers (and especially Lenovos) should use undionly.kkpxe

To find your network address, you'd type:


Set the FOG services to start 30 seconds after boot

(necessary with Fedora 21 & r2922 and up. There's an issue with the FOGMulticastManager after a reboot; it's timing related.)


  • Disable FOG services with:
systemctl disable FOG{MulticastManager,Scheduler,SnapinReplicator,ImageReplicator}

Create a startup script with:

vi /etc/rc.d/rc.local

Instructions on using Vi: Vi

  • Make that file look like below, exactly. This creates a 30 second delay for starting these services at boot.
#!/bin/bash
sleep 30
systemctl start FOGMulticastManager
systemctl start FOGScheduler
systemctl start FOGSnapinReplicator
systemctl start FOGImageReplicator
exit 0
  • save the file
  • Then Run this command to make that file executable:
chmod +x /etc/rc.d/rc.local















configuring the /images directory during Fedora installation (optional)



Working from the comforts of your desk (using SSH - Optional but highly recommended)

Connect using SSH from another Linux machine

ssh -l root x.x.x.x

restart server

shutdown -r


Formatting & mounting a 2nd drive (optional)

ls -l /dev/sd*
(lists all scsi/sata device files to find the new extra disk device file)

The output will look something like this.

brw-rw---- 1 root disk 8,  0 Apr  6 17:49 /dev/sda
brw-rw---- 1 root disk 8,  1 Apr  6 17:49 /dev/sda1
brw-rw---- 1 root disk 8,  2 Apr  6 17:49 /dev/sda2
brw-rw---- 1 root disk 8, 16 Apr  6 20:49 /dev/sdb

Normally sda is drive 1. sdb is drive 2. Note that SATA drives begin with sd, IDE drives begin with HD. If you had additional drives or even flash drives, they'd be listed as sdc, sdd, sde, sdf, etc. After identifying the right drive, you'll want to create a partition on it. For this, we use fdisk.

[root@localhost ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): 

hit the "m" key to get the menu, to show you what you can do in there. "g" creates a new GPT partition, so tap "g" After creating the partition, you can verify it with "p" You must write your changes with "w", otherwise nothing will be done.

We need to format that partition next (we're going to do it the ultra-simple but probably "will upset old-time Linux users" way). if you'd like an ext4 filesystem, you'd use:

mkfs.ext4 /dev/sdb

Next, we want that partition to mount to the /images directory at boot. We'll need to edit /etc/fstab for this, and you'll need to use Vi to do it (it's easy).

vi /etc/fstab

Vi is NOT anything like a GUI based text editor... Move the cursor around with your arrow keys. Put it where you want to type. Using the "right" arrow to get to the very end of a line.

press "i" to insert text. After pressing "i", you may still move around with the arrows, but now you have editing ability. You can use things like backspace, enter, and you can type.

You need to add this line to the end of the file. Make sure to use the right partition name, and the right file system type.

/dev/sdb    /images    ext4    defaults    0    0


When you're done, you need to stop "inserting", to do that, hit the escape key. Now, you need to write your changes. do that by typing :w and then hit enter. It should tell you it wrote the changes. Next, to quit, type :q and hit enter.


You may reboot to mount, or you can mount now using this:

cd /
mkdir images
mount /images

All done.






mounting a smb share/NAS at boot to store images (optional)

cd /
mkdir images
sudo chmod -R 777 images
vi /etc/fstab
//x.x.x.x/RemoteSharedFolder /images cifs username=UserNameHere,password=PasswordHere,noperm,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

Where x.x.x.x is the remote share's IP. Replace the username and password. Please note that you're password will be stored in plain-text. You MIGHT want to create a user on the hosting server, and give that user a non-critical password, and assign that user ownership to the share with full control, and disallow everyone else.



Installing SVN (required) (installs Beta of Subversion)

yum install svn


Updating Fedora (optional)

yum update

SSH'ing into your server (optional, but strongly recommended). SSH is the ONLY thing that isn't blocked in Fedora by default. The default firewall in Fedora has everything locked down except SSH. All other versions of Linux that I know of come with the firewall disabled. This hints at SSH's importance!

ssh -l root x.x.x.x

Note: this is for SSH'ing in from another linux computer. From windows, you can use PuTTY [1].


Static IP address

yum install system-config-network
cd /usr/bin
./system-config-network

Follow on-screen prompts (it's easy).


Disable firewall and SELinux.

systemctl disable firewalld.service
vi /etc/selinux/config

Change the line:

SELINUX=enforcing

To:

SELINUX=disabled

generally, the easy way to make the SELinux setting take effect is to reboot.


Installing FOG

dnsmasq (ProxyDHCP) setup


edit the ltsp.conf file:

vi /etc/dnsmasq.d/ltsp.conf
port=0
log-dhcp
tftp-root=/tftpboot
dhcp-boot=undionly.0,x.x.x.x,x.x.x.x
dhcp-option=17,/images
dhcp-option=vendor:PXEClient,6,2b
dhcp-no-override
pxe-prompt="Press F8 for boot menu", 3
pxe-service=X86PC, “Boot from network”, undionly
pxe-service=X86PC, "Boot from local hard disk", 0
dhcp-range=x.x.x.x,proxy

Restart dnsmasq:

systemctl restart dnsmasq.service

Enable dnsmasq to start on boot:

systemctl enable dnsmasq.service

Full FOG DHCP setup