Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

This video will guide you through the steps of setting your computer up to boot two different operating systems




While I manage most of my Linux servers through command lines, sometimes I rather use a desktop manager like Gnome. When I need to access my desktop remotely, I mainly use VNC (or Virtual Network Computing). VNC provides remote control software which lets you see and interact with desktop applications across any network. You can install the server software on about any platform like MS Windows, Linux or Mac OS. To access the remote system, you can either use the VNC client or a web browser with java enabled.
VNC (or Virtual Network Computing) has been around for a long time now. I remember using it when I first got my first job as a programmer almost ten years ago and it already been out for sometime back then.

Installing VNC Server On Linux

For this tutorial, I will be using CentOS 5 but installing VNC Server on CentOS 4 or RHEL shouldn’t be no different. Of course we’ll take for granted that X is installed and working properly.
Installing the VNC server is pretty easy. You can do this using YUM:
# yum install vnc

Configuring VNC Server

You can configure multiple displays for different users, resolutions, etc. To do this, simply edit /etc/sysconfig/vncservers using your prefered editor. The example above shows you how to create a display for the root user:
VNCSERVERS=”2:root”
VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp”
The first line specifies the display number and the local user for who this display will be available. Note that VNC will add 5900 to this display number as the service port. So for example, if you specify display number 2, it will be accessible on port 5902 for the VNC client. As for the HTTP client, it will add 5800 to the display number (http://myserver:5802).
The second line specifies the parameters for display #2. To get more information on VNC server arguments, see the manpages (man vncserver).
Now that you’ve created a display, you now need to set the password for the user(s) you’ve specified. You can do this using the vncpasswd command when logged on as the desired user. Simply type vncpasswd at the command prompt and you will be required to enter and confirm a password. This will store the newly created password into ~/.vnc/passwd.
You can now test the VNC server by starting it manually:
# service vncserver start
For this example, I’ve installed the VNC client from http://www.realvnc.comon MS Windows to access my Linux desktop remotely. I won’t go into details about installing the VNC client on MS Windows, it’s pretty basic. You can also get a VNC viewer for Linux over at http://www.tightvnc.com/.
Now that your VNC server is running, launch the client and enter the IP address of the remote host followed by the port number (display number + 5900).
VNC Viewer On MS Windows
This is what your remote desktop should look like:
VNC Desktop
It sucks huh? Right. Because there’s no desktop manager loaded. To make sure that X is started upon connection to the VNC server, you must edit ~/.vnc/xstartup so that the xstartup script is invoked instead of twc. On the last line of ~/.vnc/xtartup, replace twc by xstartup:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
 unset SESSION_MANAGER
 exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
xstartup &
Now simply restart the VNC server (service vncserver restart) and try to access it remotely once again.
VNC Desktop - Gnome
Now that’s better!
All that’s left to do is to have the VNC server started at boot time. To do this, simply issue the command:
# chkconfig vncserver on
VNC server will always be listening on the ports you’ve configured through/etc/sysconfig/vncservers.


Setting up a static IP address for your linux box is quite easy. I will show you how to do it through the GUI and command line.
For this tutorial, I have been using CentOS 5 running as a virtual machine on VMware Server 1.0.2.

Setting Up A Static IP Address Using The GUI

If you are using Gnome, click on “System => Administration => Network”.
linux-static-ip-address-1.jpg

From the Network Configuration window, select your NIC from de “Devices” tab and click on the “Edit” button.
linux-static-ip-address-2.jpg
Select “Statically set IP addresses” and enter the IP address, subnet mask and default gateway. Click OK when done.
linux-static-ip-address-3.jpg
Now back to the Network Configuration window, select the DNS tab. Enter your hostname and your DNS servers.
linux-static-ip-address-4.jpg
Click on “File => Save” when you’re done.

Setting Up A Static IP Address Using The Command Line

Log on as root, change directory to /etc/sysconfig/networking/devices and list all available devices.
# cd /etc/sysconfig/networking/devices
# ls
Find the configuration file corresponding to the NIC for which you want to set a static IP and edit it.
# vi ifcfg-eth0
I prefer using “joe” as a text editor rather than “vi”. You can install “joe” by issuing “yum install joe”. To invoke joe’s help menu, type “CTRL+K, H” from within the application.
Now set the parameters below according to your settings (those in bold characters only):
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:DE:94:8B
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NETMASK=255.255.255.0
IPADDR=192.168.0.100
GATEWAY=192.168.0.1
Save the configuration file and exit the text editor.
To set the nameservers, change directory to /etc and edit resolv.conf.
# cd /etc
# vi resolv.conf
The file format should be like this:
search your-dns-search-path
nameserver dns1-ip-address
nameserver dns2-ip-address
nameserver dns3-ip-address
Now save the configuration file and exit the text editor. To apply changes, we need to bring the network interface down and back up.
# ifdown eth0
# ifup eth0
If you intend to do that remotely, reboot the server instead as you would be disconnected from your server after issuing the “ifdown” command.


There is a lot of information on how to configure a RAID 5 setup in Ubuntu Server out of there in the Internet, but somehow I had a hard time finding an easy to follow tutorial when I was setting up  the server this blog is currently running on.  the server is a high end PC, and even though the computer already comes with a BIOS RAID setup utility,I chose to use the Ubuntu Server RAID software, because it has more capabilities. one of the important things to keep in mind while setting up a RAID in Ubuntu is:

Ubuntu cannot boot from a RAID 5 partition.
so you need to create at least two partitions to install Ubuntu. one with either RAID 0 or RAID 1 for the operating system and the other with RAID 5 for the file directory.
on this tutorial I will use a VM with 5 small virtual disks for a RAID 1 and RAID 5 setup. please remember that in Ubuntu you can add partitions to a RAID as well, so you don’t necessarily have to have 5 physical drives for this setup. as long as you have a big hard drive, you can slice it into partitions to configure the RAIDs.
without further talks, let’s jump in.
fire up your Ubuntu Server. the initial windows will come up:
image
choose your language and hit Enter.
the installation Server wizard windows will pop-up:
image
Press the enter key on your keyboard. choose your language again in the following Window:
image
then choose your country:
image
choose NO on the keyboard layout detection:
image
choose the right settings for your keyboard on the following two windows:
image
the keyboard detection, and other component scanning window will show up:
image
choose a hostname for your server on the following window:
image
choose your time zone:
image
the partition manager will come up. choose Manual :
image
Choose the first partition on the list and press Enter:
image
the following warning will come up. choose Yes.
image
The new created partition will show up as free space on the next window:
image
Select the partition and press the Enter. the create a new partition window will come up:
image
press Enter again. type the size for the partition. in this case, it is the entire disk:
image
click  on continue. and choose Primary on the partition type:
image
click on Done setting up the partition on the following window:
image
do the same thing we just did for the rest of the drives. once you have all the drives partitioned. they should look like this:
image
select Configure Software RAID on the top menu:
image
say Yes on the following warning:
image
the changes will be written to the disk:
image
after that, the Software RAID configuration window will come up:
image
select Create MD device. and press Enter.
we will create the RAID 1 drive first. choose RAID1 on the following menu:
image
choose the number of drives on the following window. RAID1 needs 2 drives, so enter the number 2 and click on continue:
image
enter 0 for spare devices on the following window, and click on Continue.
image
choose the drives on the following menu. only choose 2 for RAID1 by using the down arrow key and the space bar. after the two drives are chosen, click on Continue:
image
Say Yes to the following warning:
image
by now, the RAID 1 configuration should be completed. Now let’s setup the RAID 5. click on Create MD configuration again:
image
choose RAID5 on the following window, and hit Enter.
image
choose the number of disks on the following window.  choose 3. and click on Continue.
image
put 0 as spare drives. and click Continue.
image
choose the disks you want to configure. choose the 3 disks and click on Continue.
image
click yes on the following warning:
image
that’s it. we have completed the RAID setup on Ubuntu. click on Finish.
image
now you should have two partitions available on your Ubuntu server. one for 10 GB ( mirrored RAID1 drive ) and 21 GB the RAID 5 partition.
image
lets setup the installation now. select the first 10GB partition, and hit Enter.
on the following window. select use As: and hit enter. on the list choose the first option. Ext4 Journaling File System and hit enter again:
image
then select Mount Point and choose / – the root file system and click enter again:
image
choose Done setting up the partition on the below menu:
image
do the following to setup the 21GB RAID 5 partition, but instead of choosing the mount point, choose/Var for the mount point. if you are using the server for web hosting apache WWW directory is at the /Var directory. you make your own decision to what directory you assign the RAID 5 partition.
after you’re done with the partitions setup. click Finish partitioning and write changes to disk on the menu below:
image
from here on continue the installation of Ubuntu as usual.
after finishing the installation. you should have a fully functioning Ubuntu server with RAID1 for the boot partition, and a RAID 5 for the /Var file system:
image
I hope this tutorial gives you an idea on how to setup a RAID on Ubuntu server.