Step by Step Linux Guide By
Total Page:16
File Type:pdf, Size:1020Kb
Step by Step Linux Guide by M. B. G. Suranga De Silva Step by Step Linux Guide, describes the system administration aspects of using Linux. It is intended for people who know nothing about system administration. This book TM Step by Step Linux Guide. Page 1 doesn’t tell you how to install Linux since it is very straight forward but it gives you real world mail, DNS, proxy, web, messaging etc… server installations and configurations. System administration is all the things that one has to do to keep a computer system in a useable shape. It Includes things like backing up files and restoring , installing new programs, creating accounts for users, making certain that the filesystem is not corrupted, and so on. There is no one official Linux distribution, so different people have different setups, and many people have a setup they have built up themselves. This book is not targeted at any one distribution, even though I use Red Hat Linux 8 and 9 the contents can be applied to any distribution. Many people have helped me with this book, directly or indirectly. I would like to especially thank my own brother Dilan Kalpa De Silva, Luckshika Jayadeva for her excellent type-setting, my ever loving mother, two sisters and my aunt Mallika Vitharana. TM Step by Step Linux Guide. Page 2 Quick Configs Jabberd Sendmail Qpopper Qmail CourrierIMAP Server Squirrelmail DHCP Server PHP and Mysql PostGRE File Server Squid Squidguard Iptables Freeradius Apache Apache Monitoring Tool (AWTStats) Samba DNS Bind OpenLDAP NoCatAuth Load Balancers Load Sharing Network Monitoring Tool (nagios) Kernal Recompilation Java in Linux Linux commands in brief TM Step by Step Linux Guide. Page 3 Target Market IT Training Institutes IT Departments of any organization Libraries (school/public/ universities) Students Unique Selling Points 1. Open Source freely available 2. Stable 3. Everything in single book 4. Administrators can build their own systems, from that they can take the full control over the system. When company relies on the system, administrators will feel more job security. 5. No need of expensive PCs to learn, just 486 is enough to become an expert. 6. High Security 7. Free Five hours onsite cooperate training. 8. Easiest way to become a System Administrator or Systems Engineer. Jabberd Quick Installation Guide TM Step by Step Linux Guide. Page 4 The jabberd server is the original open-source server implementation of the Jabber protocol, and is the most popular software for deploying Jabber either inside a company or as a public IM service. 1. Save the file jabberd-1.4.2.tar.gz to /tmp/ (or to a directory of your choice). 1. Open a console window and create the directory as /path/to/jabber/ as follows [root@im root]#mkdir /path/ [root@im root]#mkdir /path/to/ [root@im root]#mkdir /path/to/jabber/ 3. Type mv /tmp/jabberd-1.4.2.tar.gz /path/to/jabber/ 4. Type cd /path/to/jabber/ 5. Type gzip -d jabberd-1.4.2.tar.gz 6. Type tar -xvf jabberd-1.4.2.tar (this creates a jabberd-1.4.2/ directory containing various files and subdirectories) 7. Type cd jabber-1.4.2/ 8. Type ./configure 9 Type make 10. Open another console and type cd /path/to/jabber/jabber-1.4.2/ 11. Type ls -l jabberd/jabberd to view the permissions on the Jabber daemon. The output on your console should look something like this: -rwxr-xr-x 1 user group 675892 Feb 25 2004 jabberd/jabberd 12. Type ./jabberd/jabberd to start the Jabber daemon. This will run the server using the default hostname of localhost. You should see TM Step by Step Linux Guide. Page 5 one line of output in your console window: 20020923T02:50:26: [notice] (-internal): initializing server. 13. Open a separate console window on the same machine and type telnet localhost 5222 to connect to your server (yes, you can connect using simple old telnet!). You should see the following: Trying 127.0.0.1... Connected to your-machine-name. Escape character is '^]'. 14. Now open an XML stream to your server by pasting the full text of the following XML snippet into your telnet window: <stream:stream to='localhost' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'> You should immediately receive a reply from your server: <?xml version='1.0'?> <stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='some-random- id' xmlns='jabber:client' from='localhost'> Congratulations! Your Jabber server is working. 15. Close the stream properly by pasting the following XML snippet into your telnet window: </stream:stream> 16. Stop the server by killing the process or simply typing ^C in the window where you started the server deamon. Configuring the Hostname TM Step by Step Linux Guide. Page 6 You change the configuration of jabberd by editing a file named jabber.xml, which is located in your /path/to/jabber/jabber-1.4.2 directory. The jabber.xml file contains a great deal of comments that help you understand what each configuration option does. However, right now all that we need to change is the hostname. So open jabber.xml in your favorite text editor (vi, emacs, etc.) and edit the line that reads as follows: <host><jabberd:cmdline flag="h">localhost</jabberd:cmdline></host> You now need to give Jabber server's ip address or hostname here. Ex. <host><jabberd:cmdline flag="h">192.168.200.8</jabberd:cmdline></host> or <host><jabberd:cmdline flag="h">im.jic.com</jabberd:cmdline></host> Note: Make sure to create a folder and name it as the name you put in the above line that is 192.168.200.8 or im.jic.com in /path/to/jabber/jabber-1.4.2/spool/ Ex: [root@im root]#mkdir /path/to/jabber/jabber- 1.4.2/spool/192.168.200.8 or [root@im root]#mkdir /path/to/jabber/jabber-1.4.2/spool/im.jic.com Now you need to configure your server to bind to a specific IP address. First, in the <pthcsock/> section of your jabber.xml file, change <ip port="5222"/> to <ip port="5222">yourIPaddress</ip>. Second, in the TM Step by Step Linux Guide. Page 7 dialback section of your jabber.xml file, change <ip port="5269"/> to <ip port="5269">yourIPaddress</ip>. Ex: <ip port=”5222”>192.168.200.8</ip> <ip port=”5269”>192.168.200.8</ip> Now jabber.xml and type in console again ./jabberd/jabberd to start the Jabber daemon previously you have killed. Install windows jabber client exodus version:0.9.0.0 in your win PC in the same lan segment that the jabber server runs. You can specify the jabber server name by typing server name or ip address in the Server drop down menu. Type your user name and password (any username and password you like) and click “ok” or TM Step by Step Linux Guide. Page 8 Then it ask to create a new user since it was not previously in the jabber server. Click “yes” and proceed. You need to add another user like this and add contact between the other user and start messaging. Following screenshots show how to add a new contact. TM Step by Step Linux Guide. Page 9 or TM Step by Step Linux Guide. Page 10 Sendmail Quick Installation Guide 1. Go to the /etc/mail folder and select the “sendmail.mc” file. 2. Open “sendmail.mc” file in any available text editor. (Remember not to make any changes to sendmail.cf file) 3. Add the following lines to the sendmail.mc file using the text editor. FEATURE(always_add_domain)dnl FEATURE(`masquerade_entire_domain’) FEATURE(`masquerade_envelope’) FEATURE(`allmasquerade’) MASQUERADE_AS(`slts.lk.’) MASQUERADE_DOMAIN(`slts.lk.’) MASQUERADE_AS(slts.lk) Note: Replace slts.lk by the domain name of your organization TM Step by Step Linux Guide. Page 11 4. Comment the following line in the sendmail.mc file by adding “dnl” in front: DAEMON_OPTIONS(`port=smtp, ……..) Changed lines should look like this: dnl DAEMON_OPTIONS(`port=smtp, ……..) 5. Type the following in the command prompt to generate a new “sendmail.cf” file: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf 6. Add the following lines to etc/mail/access file: localhost.localdomain RELAY localhost RELAY 192.168.1 RELAY slts.lk RELAY Note: Add the network id of your domain and domain name instead of the values given here. 7. Type the following in the command prompt: makemap hash /etc/mail/access.db < /etc/mail/access 8. Add the following lines to the /etc/mail/local-host-names file: slts.lk eng.slts.lk Note: Add the names of your domains or sub-domains TM Step by Step Linux Guide. Page 12 9. Add the following entries to the etc/hosts file: 127.0.0.1 mail.slts.lk mail 127.0.0.1 mail.eng.slts.lk mail Note: These are aliases for the local server. Replace the entries with your own domain info. 7. Edit the /etc/sysconfig/network as follows: NETWORKING = YES HOSTNAME = mail.slts.lk Note: Replace with your own domain info. 8. Edit the /etc/sysconfig/networking/profiles/default/network file HOSTNAME = mail.slts.lk 9. Type the following in command prompt to restart sendmail /sbin/service sendmail restart 10. To test sendmail type following in the command prompt: telnet localhost 25 TM Step by Step Linux Guide. Page 13 Qpopper Quick Installation Guide 1. Make /usr/local/qpopper/ directory and download and save qpopper4.0.5.tar.gz file to that directory directory. 2. Go to the directory where qpopper is stored (/usr/local/qpopper/) and type following in the command line: gunzip qpopper4.0.5.tar.gz then type: tar xvf qpopper4.0.5.tar 3.