During the past week I spend most of my time and effort on installing and configuring Ubuntu Server 10.04.3 and required applications, so following are some of the useful commands I came across.
As a practice, when installing GNU Linux I partition the harddisk as follows by selecting the option of manual partition.
/– Root partition
/boot– Boot partition, that keep the grub loader, especially important when multiple operating systems are installed.
/home– Home partitions where the user data will be stored
swap– Swap partitions, recommends to allocate double the size of RAM attached to the machine.
Once the partitioning is completed the OS installation will take few minutes to complete. Next step will be to configure the server to establish a connection to the Internet via the local network.
Network Configuration – Static IP approach
Let us see the steps involve in assigning a static IP and the DNS information.
- Check whether the network card is properly working and the cable is properly connected as follows:
$ sudo mii-tool eth0
should give the details of the network card instead of no link message.
- Backup the existing interfaces configuration file as follows:
$ sudo cp /etc/network/interfaces /etc/network/interfaces.bk
and open the interfaces file as following
$ sudo vim /etc/network/interfaces
- Replace the values for address, netmask, gateway, and broadcast with values specific to your desired IP address and network.
# The loopback network interface
iface lo inet loopback
iface eth0 inet static
- Setting the IP’s for the DNS Server(s), backup the resolv.conf as follows:
$ sudo cp /etc/resolv.conf /etc/resolv.conf.bk
and update the nameservers as follows:
$ sudo vim /etc/resolv.conf
- Next, restart the network interfaces as follows:
$ sudo /etc/init.d/networking restart
- Finally, test the configuration first by pinging to the Gateway IP and then to another external IP or site like http://www.google.com
$ ping 192.168.1.1
PING 192.168.1.40 (192.168.1.40) 56(84) bytes of data.
64 bytes from 192.168.1.40: icmp_seq=1 ttl=64 time=0.051 ms
64 bytes from 192.168.1.40: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 192.168.1.40: icmp_seq=3 ttl=64 time=0.068 ms
Mount/unmount a filesystem – External hard disk with a ntfs filesystem
- Find the device name (eg: /dev/sdb1) required to mount using the following command.
$ sudo fdisk -l
- Create a mount point and mount the external hard disk as follows:
$ sudo mkdir /media/external_hard
$ sudo mount -t ntfs-3g /dev/sdb1 /media/external_hard
- Unmount the hard disk as follows:
$ sudo umount /media/external_hard