How to install Webmin
WEBMIN
Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely.
Install Webmin (Successfully tested/configured on Ubuntu server 10.04)
#sudo aptitude safe-upgrade
#sudo aptitude update
#sudo aptitude install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl apt-show-versions
#sudo mkdir downloads
#cd downloads
#sudo wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb?use_mirror=cdnetworks-us-1
or
#sudo wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510
/webmin_1.510-2_all.deb?use_mirror=kent
#sudo dpkg -i webmin_1.510-2_all.deb
Incase the installation is not successful, try the following command
#sudo aptitude -f install
=>>You can access the Ubuntu machine from a Windows machine via a web browser by typing the address
https://yourip:10000or
https://core:10000 , here core is the name of my Ubuntu server.
Apt-Get command line tool
Apt-Get command line tool
(Ubuntu's Advanced Packaging Tool) !!!
The apt-get command is a powerful command-line tool used to work with Ubuntu's Advanced Packaging Tool (APT) performing such functions as installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire Ubuntu system.
*Install package
#sudo apt-get install packagename
*Remove Package
#sudo apt-get remove packagename
*Install Multiple Packages
#sudo apt-get install packagename1 packagename2 packagename3
*Update the Package Index
#sudo apt-get update
The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file.
*Upgrade the system
#sudo apt-get upgrade
*Read Debian APT User Manual
#sudo apt-get help
Tags: apt get apt-get advanced packaging tool install remove upgrade update help ubuntu linux unix package-management
How to install a DNS Server
How to install a DNS Server
File Configuration bind9 on Ubuntu 10.04 :
/etc/bind
/etc/bind/named.conf.local
/etc/bind/named.conf.options
/etc/resolv.conf
/var/lib/bind
Step 1: Install Ubuntu dapper, or use your WORKING installation.
Step2: Install bind 9 and dnsutils:
Code: sudo apt-get install bind9 dnsutils
Step 3: Configure the main Bind files. Usually, if you install Bind from the source code, you will have to edit the file named.conf. However, Ubuntu provides you with a pre-configured Bind, so we will edit another file:
Code: sudo vi /etc/bind/named.conf.local
This is where we will insert our zones. By the way, a zone is a domain name that is referenced in the DNS server icon wink Dns server with bind9 and dnsutils on ubuntu 10.04
Insert this in the named.conf.local file:
Code:
# This is the zone definition. replace example.com with your domain name
zone "example.com" {
type master;
file "/etc/bind/zones/example.com.db";
};
# This is the zone definition for reverse DNS.
replace 0.168.192 with your network address in
reverse notation - e.g my network address is 192.168.0
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
};
Ok, now, let’s edit the options file:
Code: sudo vi /etc/bind/named.conf.options
We need to modify the forwarder. This is the DNS server to which your own DNS will forward the requests he cannot process.
Code:
forwarders {
# Replace the address below with the address of your provider's DNS server
123.123.123.123;
};
Now, let’s add the zone definition files (replace example.com with your domain name:
Code:
sudo mkdir /etc/bind/zones
sudo vi /etc/bind/zones/example.com.db
The zone definition file is where we will put all the addresses / machine names that our DNS server will know. You can take the following example:
Code:
// replace example.com with your domain name.
do not forget the . after the domain name!
// Also, replace ns1 with the name of your DNS server
example.com. IN SOA ns1.example.com. admin.example.com. (
// Do not modify the following lines!
2006081401
28800
3600
604800
38400
)
// Replace the following line as necessary:
// ns1 = DNS Server name
// mta = mail server name
// example.com = domain name
example.com. IN NS ns1.example.com.
example.com. IN MX 10 mta.example.com.
// Replace the IP address with the right IP addresses.
www IN A 192.168.0.2
mta IN A 192.168.0.3
ns1 IN A 192.168.0.1
Now, let’s create the reverse DNS zone file:
Code:
sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa
Copy and paste the following text, modify as needed:
Code:
//replace example.com with yoour domain name, ns1 with your DNS server name.
// The number before IN PTR example.com
is the machine address of the DNS server.
in my case, it's 1, as my IP address is 192.168.0.1.
@ IN SOA ns1.example.com. admin.example.com. (
2006081401;
28800;
604800;
604800;
86400
)
IN NS ns1.example.com.
1 IN PTR example.com
Ok, now you just need to restart bind:
Code: sudo /etc/init.d/bind9 restart
We can now test the new DNS server…
Step 4: Modify the file resolv.conf with the following settings:
Code: sudo vi /etc/resolv.conf
enter the following:
Code:
// replace example.com with your domain name,
and 192.168.0.1 with the address of your new DNS server.search example.com
nameserver 192.168.0.1
Now, test your DNS:
Code: dig example.com
How to configure Squid Proxy Server
Squid Server
Squid is a proxy server. HTTP requests are sent to Squid instead of being sent directly to the internet.
Install Apache
Find the http_port tag, By default it reads
# http_port 3128
This is the default port that Squid will listen on for requests. If you want to change it, uncomment the line and set the correct port. If you want Squid to listen only on one specific NIC, you can also change the IP address – for example : 192.168.1.5:3128
Next, find the http_access section Uncomment these 2 lines:
acl our_networks src 192.168.1.0/24 192.168.2.0/24
http_access allow our_networks
NOTE: You'll need to change 192.168.1.0/24 to match your network. Unless you have a second subnet you can delete 192.168.2.0/24
# apt-get install apache2
Install Squid
# sudo apt-get install squid
Key File Locations
File | Purpose |
/etc/squid/squid.conf | Squid configuration file |
/var/log/squid/access.log | Squid access log file |
# vi /etc/squid/squid.conf
Find the http_port tag, By default it reads
# http_port 3128
This is the default port that Squid will listen on for requests. If you want to change it, uncomment the line and set the correct port. If you want Squid to listen only on one specific NIC, you can also change the IP address – for example : 192.168.1.5:3128
Next, find the http_access section Uncomment these 2 lines:
acl our_networks src 192.168.1.0/24 192.168.2.0/24
http_access allow our_networks
NOTE: You'll need to change 192.168.1.0/24 to match your network. Unless you have a second subnet you can delete 192.168.2.0/24
# sudo /etc/init.d/squid start|restart|stop
On client PC, change the firefox/IE browsers proxy setting with the Squid server's
IP address (for eg 10.1.0.1) and port 3128.
What is a Zombie Process
Zombie Process
On Unix operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table, allowing the process that started it to read its exit status. The term zombie process derives from the common definition of zombie—an undead person. In the term's colorful metaphor, the child process has died but has not yet been reaped.
When a process ends, all of the memory and resources associated with it are deallocated so they can be used by other processes. However, the process's entry in the process table remains. The parent is sent a SIGCHLD signal indicating that a child has died; the handler for this signal will typically execute the wait system call, which reads the exit status and removes the zombie. The zombie's process ID and entry in the process table can then be reused. However, if a parent ignores the SIGCHLD, the zombie will be left in the process table. In some situations this may be desirable, for example if the parent creates another child process it ensures that it will not be allocated the same process ID.
A zombie process is not the same as an orphan process. Orphan processes don't become zombie processes; instead, they are adopted by init (process ID 1), which waits on its children.
Zombies can be identified in the output from the Unix ps command by the presence of a "Z" in the STAT column. Zombies that exist for more than a short period of time typically indicate a bug in the parent program. As with other leaks, the presence of a few zombies isn't worrisome in itself, but may indicate a problem that would grow serious under heavier loads.
To remove zombies from a system, the SIGCHLD signal can be sent to the parent manually, using the kill command. If the parent process still refuses to reap the zombie, the next step would be to remove the parent process. When a process loses its parent, init becomes its new parent. Init periodically executes the wait system call to reap any zombies with init as parent.
When a process ends, all of the memory and resources associated with it are deallocated so they can be used by other processes. However, the process's entry in the process table remains. The parent is sent a SIGCHLD signal indicating that a child has died; the handler for this signal will typically execute the wait system call, which reads the exit status and removes the zombie. The zombie's process ID and entry in the process table can then be reused. However, if a parent ignores the SIGCHLD, the zombie will be left in the process table. In some situations this may be desirable, for example if the parent creates another child process it ensures that it will not be allocated the same process ID.
A zombie process is not the same as an orphan process. Orphan processes don't become zombie processes; instead, they are adopted by init (process ID 1), which waits on its children.
Zombies can be identified in the output from the Unix ps command by the presence of a "Z" in the STAT column. Zombies that exist for more than a short period of time typically indicate a bug in the parent program. As with other leaks, the presence of a few zombies isn't worrisome in itself, but may indicate a problem that would grow serious under heavier loads.
To remove zombies from a system, the SIGCHLD signal can be sent to the parent manually, using the kill command. If the parent process still refuses to reap the zombie, the next step would be to remove the parent process. When a process loses its parent, init becomes its new parent. Init periodically executes the wait system call to reap any zombies with init as parent.
$ ps -aef -H (will list all processes with hierarchy structure.)
$ kill -9 5373 (Here 5343 is the process id)
How to add an account to the sudoer list
Add an account to the sudoer list
When logged in as a user with sudo privileges:
sudo adduser name_of_user admin
2) Graphical Interface
Go to System--> Administration --> Users and Groups.
Then:
(1) Click on the name of the user that you want to elevate.
(2) Click on the properties button to open a new settings window.
(3) In the new window, click on the User Priviledges tab.
(4) Check the box next to "Executing system administration tasks".
Click OK all the way out, and that user should now be able to sudo.
How to Install NFS Server
NFS Server
The Network File System (NFS) was developed to allow machines to mount a disk partition on a remote machine as if it were a local disk. It allows for fast, seamless sharing of files across a network.
It also gives the potential for unwanted people to access your hard drive over the network (and thereby possibly read your email and delete all your files as well as break into your system) if you set it up incorrectly.$ sudo aptitude -P install nfs-kernel-server nfs-common portmap When configuring portmap do =not= bind loopback. If you do you can either edit /etc/default/portmap by hand or run:
$ sudo dpkg-reconfigure portmap If you have edited the file by hand you can restart portmap via:
$ sudo /etc/init.d/portmap restart Note: It is not necessary to install NFS on client machines which are not going to be sharing any of their own directories. Sharing Local Folders To specify a folder you will need to edit /etc/exports, which can be done like (replace vi for your favorite editor):
$ sudo vi /etc/exports For an example I will share, with full read/write and privileges, my share directory. This directory will be broadcasted to every local IP from 192.168.1.1 through 192.168.1.255.
$ /home/rohan/share 192.168.1.1/24(rw,no_root_squash,async)To share a read only drive, for example on a Windows NTFS drive, you can use something like the following:
/media/songs/music 192.168.1.1/24(ro,async)
$ sudo /etc/init.d/nfs-kernel-server restart After making changes to /etc/export you can make the shares effect by issuing the:
sudo exportfs -a *Use on the other PC - Last you will need to mount the volume on the other computer. So, ether shift screens or SSH to lab2 and open a terminal. You can only mount into another folder which must be created.
sudo mkdir ~/music Now mount music from lab1 into ~/music at lab2.
$ sudo mount 192.168.1.2:/media/songs/music ~/music