Configuring the web server (Apache Server)

01. Check the necessary RPM
#rpm –q httpd

02. Developed a web site and copied it in to
/var/www/html folder
If you have multiple web sites you can keep them in sub folders in the above location
The web site home page must be named as index followed by the web developing language extension.
Ex – index.htm, index.php , index.asp

03. Publishing the web site
#nano /etc/httpd/conf/httpd.conf
Go to the end of file
Ex – www






04. Save and Exit the file

05. Start the service
#service httpd start
#chkconfig httpd on

------------------------------------------------------------------------------------------


Configuring Proxy Server

1. Check the necessary RPM
#rpm –q squid

2. Set the default gateway and the DNS on the proxy server, so it has a direct connection as an internet.
#system-config-network-tui

3. Give the information about your local network on the proxy server.
#nano /etc/squid/squid.conf
Press CTRL + W
Search – our_networks

4. Uncomment this lines
#acl our_networks src 192.168.1.0/24 192.168.2.0/24 //Remove # mark
#http_access allow our_networks //Remove # mark

5. Save (CTRL + O) and Exit (CTRL + X) file

6. Start the proxy service
#service squid start
#chkconfig squid on

Settings up proxy clients

The proxy client is an application that required internet through the proxy server
EX – Internet Explorer, Mozilla Firefox

Fire Fox
Edit --> Preferences --> Advanced --> Network --> Settings --> manually proxy configuration
http proxy : 192.168.2.101 port : 3128 // proxy server IP and port number

Now clients have to access internet through proxy………

Controlling web access through proxy

1. Open the following file
#nano /ect/squid/squid.conf
Press CTRL + W
Search – # http_access deny all

Put all the rules that you want to control web access through proxy under the above comment. All the block rules must come before the allow rules

• To block unwanted website
acl blockweb dstdomain .facebook.com .yahoo.com .google.com
http_access deny blockweb

• To block unwanted file download
acl blockfile urlpath_regex –i exe$ mp3$ avi$ rar$
http_access deny blockfile

• To allow POP3/ SMTP to access mail through proxy server
acl allowmail proto POP3 SMTP
http_access allow allowmail

2. Save (CTRL + O) and exit (CTRL +X) the file

3. Reload squid service
#service squid reload
---------------------------------------------------------
List of acl tags and examples
http://tr.im/sqacl
http://wiki.squid-cache.org
---------------------------------------------------------

Configuring a windows file server

1.Check the necessary rpm
#rpm -q samba

2.set the samba work group name according to windows work group or domain name.
#nano /etc/samba/smb.conf
Press CTRL + W
Search >>>> “ mygroup
delete the mygroup and type your windows work group or domain name

3.Start the samba service
#service smb start
#chkconfig smb on

4.Now you will be able to see the samba servers through my network places in windows, but you wont be able to access them unless you create samba user accounts in linux.

5.You must have a Linux user account first
#useradd uddika
#passwd uddika

6.you can convert them in to samba
#smbpasswd -a uddika
you can use user current password or another one.

7.Once you add a user to samba his home folder will be automatically shared. How to share a different folder through samba.

8.Create a folder to share
#cd /
#mkdir test

9.sharing above folder through samba
#nano /etc/samba/smb.conf
Go to a end of file, to a new line
[MyTestShare]
path = /test
public = yes
writable = yes

10.Save and exit the file
CTRl + O
CTRL + X

11.Reload the samba service
#service smb reload

12.Although we give a writable samba permissions, normal samba users wont be able to witting to the folder though windows, unless we change the ext3 file folder permissions properly.

13.See current permissions
#cd /
#ls -ld test

14.Change current permissions
#chmod 757 test
#ls -ld
now normal users can access share folder

------------------------------------------------------------------------------------------

Configuring Slave NIS Server

The machine that we are going to configure as a NIS Slave server must be and existing client on the domain.

1. From the master server we have to give the permissions to replicate the data to the slave servers.

Master Server Side

Edit system file
[root@server ~]#nano /var/yp/Makefile
Change NOPUSH = true to NOPUSH = false

• Save (CTRL + O) and Exit (CTRL + X) file

Slave Server Side

On the machine that you are going to configure as the slave server

• Check the necessary RPM’s
[root@server ~]#rpm –q ypserv yp-tools ypbind

• Set the local loopback IP as the NIS server IP to indicate the machine Is going to become NIS server
[root@server ~]#nano /etc/yp.conf
Go to end of file, to a new line and type
ypserver 127.0.0.1

• Start the necessary NIS server services
[root@server ~]#service yppasswdd start
[root@server ~]#service ypserv start
[root@server ~]#Service ypxfrd start

[root@server ~]#chkconfig yppasswdd on
[root@server ~]#chkconfig ypserv on
[root@server ~]#chkconfig ypxfrd on

• Now we can back up the master server’s database in to the slave server.
[root@server ~]#/usr/lib/yp/ypinit –s server.server.lk //master server hostname

• Since we have slave servers, now we have to update all the clients with the slave server settings (Client side configuration)
[root@server ~]#nano /etc/yp.conf
domain server.lk server 10.0.0.100 // change this line
domain server.lk broadcast //after changing

------------------------------------------------------------------------------------------

Latest Downloads

Linux Commands Ebooks

These are 3 ebooks containing over 1000+ commands. one for Fedora/RHEL/CentOS, one for OpenSUSE and one for Ubuntu. ENJOY!!

Fedora/RHEL/CentOS Ebook - download

OpenSuSe Ebook - download

Ubuntu Ebook - download

------------------------------------------------------------------------------------------

Microsoft fonts for Fedora/Redhat/Centos

Download Microsoft core fonts RPM that includes fonts in XP/Vista
Download Microsoft Fonts

------------------------------------------------------------------------------------------

Wake on LAN

Start computer from remote machine. You need to set BIOS enable function of Wake on Lan.

[1] Install wakeonlan.

[root@server ~]# wget http://gsd.di.uminho.pt/jpo/software/wakeonlan/downloads/wakeonlan-0.41-0.fdr.1.noarch.rpm

[root@server ~]# rpm -Uvh wakeonlan-0.41-0.fdr.1.noarch.rpm

warning: wakeonlan-0.41-0.fdr.1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 91bd851b
Preparing... ############################ [100%]
1:wakeonlan ############################ [100%]

[2] You need to know MAC address of the computer first you'd like to start from remote. It's possible to know 'ifconfig' command.

MAC address is just the section 'HWaddr **:**:**:**:**:**'.
Then input the commands below from remote machine and start computer.

[root@dlp ~]# wakeonlan **:**:**:**:**:**

------------------------------------------------------------------------------------------

Configuring a master NIS Server

1. Check the necessary rpm’s
#rpm –q ypserv yp-tools ypbind

2. Set the NIS Domain name
#nano /etc/sysconfig/network
At the end of file, in a new line, Type
NISDOMAIN=server.lk
Save(CTRL+O) and exit(CTRL+X) file

3. Set the local loopback ip as the nis server ip to indicate the machine is going to become for NIS server

#nano /etc/yp.conf
At the end of file, in a new line, Type
ypserver 127.0.0.1
Save(CTRL+O) and exit(CTRL+X) file

4. Start the necessary NIS server services

• yppasswdd – (NIS Password Service)
service status - #service yppasswdd status
start service - #service yppasswdd start
add startup - #chkconfig yppasswdd on
check - #chkconfig yppasswdd --list

• ypserv – NIS server service(to manage user/ group and NIS domain name)
service status - #service ypserv status
start service - #service ypserv start
add startup - #chkconfig ypserv on

• ypxfrd – NIS map service (To manage user/ group all database)
service status - #service ypxfrd status
start service - #service ypxfrd start
add startup - #chkconfig ypxfrd on

5. Now we have to create a central user and a group maagement database. During the creation you have to give the NIS slave server names one by one (optional)

#/usr/lib/yp/ypinit –m
Give slave server names one by one (if any)
After CTRL + D, press “Y” to enter, the accept the name list.
After edit he slave server list use this file
#nano /var/yp/ypservers

6. Start the NIS client service on the server, so we can join our clients to the domain
#service ypbind start
#chkconfig ypbind on

How to join a client PC to a NIS Domain (Client Side)

7. Delete all local user and group accounts from the clients

• User Accounts
#tail /etc/passwd
#userdel –r username

• Group Account
#tail /etc/group
#groupdel groupname

• Home Folder
#cd /home
#ls –l
#rm –rf homefoldername

8. Join the client to the domain

#authconfig-tui
Select “use NIS
Domain – server.lk //NIS Domain Name
Server – 10.0.0.100 //Master Server IP

Creating central user and group accounts on the master server

If there were any user accounts / group account on the master server during the practical they would be automatically converted.

• Add local account first
(user)
#useradd uddika
#passwd uddika

(group)
#groupadd mygroup

• Convert the above account in to NIS
#cd /var/yp
#make

Now you will be able to login from the client pc’s using the user account. We created on the master server but the client wont to be able to locate the users home folder. To fix the problem do the following.

9. Share the home folders from the master NIS server using NFS service (Network File System)
#service nfs status
#service nfs start
#chkconfig nfs on

To share home folders.

#nano /etc/exports
At the end of file, in a new line, Type
/home *(rw,sync)
Save(CTRL+O) and exit(CTRL+X) file
#service nfs reload
Check – #exportfs –arv

A folder shared using NFS must be access from the other machines by mounting, since it can be to dificult for normal users, to mount their own home folder. We are going to auto mount the home folders to the clients (client side configuration)

#nano /etc/fstab
At the end of file, in a new line, Type
10.0.0.100:/home /home nfs defaults 0 0
Save(CTRL+O) and exit(CTRL+X) file

How to change your own password as a NIS user

#yppasswd

How to change NIS user password as root from the master server
#yppasswd uddika
Root Password ---------------------
New Passwod ----------------------
Retype password -------------------------