Posts by :
- The webmin configuration directory
The directory in which all webmin configuration information is stored. This is now separate from the web install directory, so that configurations are saved when you upgrade.
If you have previously installed web and use the same config directory, this will be the only question asked. - The web log directory
The location for pid and webserver log files. - The full path to perl on your system
This is usually /usr/bin/perl or /usr/local/bin/perl - Your Operating system type
This question is only asked if your operating system cannot be automatically determined.
The setup script will display a list of supported systems. If your OS is not on the list, you can try choosing the closest match. However this may not work properly, and may even cause serious problems! - Web server port
The TCP port that the Webmin web server will listen on. - Web server hostname
The hostname of the machine on which Webmin will run. - Use SSL
This question will only be asked if your system has the Perl SSL libraries installed. See below for more..
Sorting commands
February 21st, 2011The command to sort the contents of the file is
#ls -al | sort
and to reverse the sorting order we use r at the end of the command as shown below
#ls -al | sort r
The command to sort the contents of the directory in disk usage basis is as follows
# du -s * | sort -n
and similarly to reverse the sorting order we use r at the end of the command as shown below
# du -s * | sort -nr
Reference: http://www.softpanorama.org/Tools/sort.shtml
Steps to install webmin in your linux servers
February 21st, 2011Before downloading Webmin, you must already have Perl 5 installed on your system. Perl is usually installed as /usr/local/bin/perl or /usr/bin/perl, and comes as part of most recent versions of Linux. If you don’t have Perl, you can download the source from http://www.perl.com/ and compile it for your system. Most operating systems come with Perl these days, so check your operating system CD or website for a package as well.
When unpacked, the distribution creates a subdirectory called webmin-1.510under the current directory. Since recent versions of webmin support installation into a directory of your choice, you can pick a destination directory such as/usr/local/webmin. Then run the following commands in the directory containing the webmin-1.510.tar.gz file : [root@yourhost /tmp]# gunzip webmin-1.510.tar.gz
[root@yourhost /tmp]# tar xf webmin-1.510.tar
[root@yourhost /tmp]# cd webmin-1.510
[root@yourhost /tmp/webmin-1.510]# ./setup.sh /usr/local/webmin
When the setup.sh script is run, it will ask the following questions :
Assuming you answer all the above questions correctly, the Webmin web server will be started and the setup script will give you the URL to go to. Enter this URL into your browser, and you will be prompted for a login and password. You should be able to login as any valid Unix user on your system.
If you installed Webmin by specifying an installation directory parameter to setup.sh as the instructions above show, the original webmin-1.510 directory can now be safely deleted.
Reference: webmin.com
Thank you for viewing helpinlinux.com
Helpinlinux linux help sites
February 21st, 2011Helpinlinux.com is a site where linux server/system administrators can get some help/tips in linux for managing their linux operating systems. Anyone can share their knowledge here and all are most welcome to join this blog.
Thanks,
-Siru
MRTG Installation steps
February 21st, 2011MRTG installation
=================
SNMP installation
[user@linux]#yum install net-snmp*
Configuration of snmpd.conf
============================
Inside the /etc/snmp/ folder, there will be the snmp configuration
file named, snmpd.conf
#mv snmpd.conf snmpd.conf.old
#vi snmpd.conf
Enter the following line in the new configuration file to set the Read
Only community string to any password of your choice, say for eg.,
1q2w3e
rocommunity 1q2w3e
[user@linux]#etc/rc.d/init.d/snmpd start
Run the following commnds from the command line
[user@linux]#snmpwalk -v 1 -c 1q2w3e localhost system [user@linux]#snmpwalk -v 1 -c 1q2w3e localhost interface
aware network device that has SNMP enabled. All you need is the IP
address and SNMP read only string and you’ll be able to get similar
results.There are currently three versions of SNMP; versions 1, 2 and 3. The
Linux snmpwalk and snmpget commands have v 1, v 2c and v 3 switches for
specifying the SNMP version to be used for queries. Always make sure you
are using the correct one.
Now that we know SNMP is working correctly on your Linux server, we can
configure a SNMP statistics gathering software package such as MRTG to
create online graphs of your traffic flows.
Gd installation
===============
This is a graphic drawing library developed by Thomas Boutell. The present versions only develop PNG images as GIF images runs into problems.
http://www.libgd.org/releases/
#wget http://www.libgd.org/releases/ #tar -xvf gd-(*.*.*).tar.gz #cd gd(*.*.*) #env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" ./configure --disable-shared --without-freetype --without-jpeg #make
For Gd to produce graphic PNG images you need libpng
====================================================
This can be downloaded from
http://sourceforge.net/projects/libpng/files/libpng15/1.5.0/libpng-1.5.0.tar.xz/download
#tar -xvf libpng-1.5.0.tar.gz #cd libpng-1.5.0 #env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR #make
zlib is needed by libpng to compress those graphic images
=========================================================
Zlib can be downloaded from
http://downloads.sourceforge.net/project/libpng/zlib/1.2.5/zlib-1.2.5.tar.gz?r=&ts=1288349087&use_mirror=space#tar -xvz zlib-1.2.5.tar.gz #cd zlib-1.2.5 #./configure #makeFinally MRTG Compilation
========================
can be downloaded from
http://oss.oetiker.ch/mrtg/pub/
#wget http://oss.oetiker.ch/mrtg/pub/mrtg-2.16.4.tar.gz #tar -xvf mrtg-2.16.4.tar.gz # cd mrtg-2.16.4 # ./configure --prefix=/usr/local/mrtg-2 #make #make install
Configuring mrtg
================
#cd /usr/local/mrtg-2/bin #mkdir /home/mrtg #./cfgmaker --global 'WorkDir: /home/mrtg' --global 'Options[_]: bits,growright' --output /home/mrtg/mrtg.cfg 1q2w3e@localhost #./indexmaker --output=/home/mrtg/index.html /home/mrtg/mrtg.cfg
Configuring on ZEUS web server
==============================
Then if that is zeus web server
1.Check the server and select the configure button
2.Now you will be taken to a new page where in left side you will have URL mapping option just below URL handling, select url mapping.
3.Add the word /mrtg/ to the space corresponding to “Map requests for (relative to document root)”
4.Add /home/mrtg/ to the space corresponding to “Map requests to (filesystem path)”
Now apply setting and save the settings
Configuration in apache web server
==================================
Configuration in apache web server is simple it is just by adding an alias in apache configuration file.
1.#vi /etc/https/conf/httpd.conf to open the apache configuration file
2.Add the line “Alias /mrtg/ /home/mrtg/” save and exit.
3.#/etc/init.d/httpd restart to restart apache server.
that’s it you are done..
Cron for mrtg
=============
#vi /var/spool/cron/root
add the following line
*/5 * * * * env LANG=C /usr/local/mrtg-2/bin/mrtg /home/mrtg/mrtg.cfg --logging /var/log/mrtg.log >/dev/null 2>&1 #service crond restart
http://serverip/mrtg/
Thank you for visiting helpinlinux.com
User administration in Linux
February 21st, 2011Hi, this topic covers the user administration in linux operating system.
The important feature of a linux machine is that. In linux machine multiple users can access the same machine at the same time.
At the end of this topic you will learn to know the following 3 things
1.Add, Remove and Modify users in a system.
2.Groups.
3.Permissions(modes).
Okay, lets get detail in the above topic
1.Add, Remove and Modify users in a system:
===========================================
To add , delete or modify users in linux you much be a root user(super user) or a administrator.
1.Adding a user
—————
Command used to add a user in linux is
#useradd
2.Remove a user
—————
Command used to delete a user in linux is
#userdel
3.Modify a user
—————
Command used to add a user in linux is
#usermod
All the above commands will be located in /usr/sbin directory.
You can specify the user config files which a new user will have when an account is created these configuration files are copied from the /etc/skel/ directory.
[skel stands for skeleton]
Now, let us see the steps in creating a new user account
Now first of all we will check the defaults of useradd command.
[root@siru /]#useradd -D
[The “-D” option means that default for useradd command]
O/P of above command is
GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel [root@siru /]#
In the above output
Group=100 It means that if we didn’t specify a group when we create a user it automatically puts the user into Group100.
HOME=/home It means that if we don’t specify a home directory it will set default home directory of that user as /home.
INACTIVE=-1
EXPIRE= these two means account expiration date, either of them is not set now by default as INACTIVE=-1 means its not described and EXPIRE= has not returned any values hence there is no expiration date for a new account unless it is set specially just in-case if the EXPIRE is set to a date say 30-11-2010 the account that has been created with this expiration date will expire on 30-11-2010 and from that date the user cannot login to the system but all his files will be kept unmodified just in-case if we unexpire that account the user can access those files as he like he left it when it expired and if INACTIVE=-1 is set to any positive value say positive 10 then the files owned by the expired user account will delete after 10 days of the particular expired account including the user id.
SHELL=/bin/bash
is the default shell for that particular account.
SKEL=/etc/skel default skeleton for that particular account, when an account is created the configuration files under this folder will be copied to the user’s account.
Now let us add an account
[root@siru /]#useradd lisa
now once I press enter after typing the above command two files will be modified, they are htpasswd and htshadow files, lisa’s home directory was created and few configuration files are copied into this directory. Let’s see them now we will go into /home directory
[root@siru /]#cd /home
now a folder named lisa will be created
[root@siru home]#ls
output of the above file will be
jeevi lisa
which means that the system has created a account names lisa now lets go into lisa directory now and i will list all the files under lisa
[root@siru home]# cd lisa
[root@siru lisa]# ls -a
output of the above command is
. .. .bash_logout .bash_profile .bashrc .emacs .gtkrc .kde .screenrc
now you can see that the files under lisa folder is user config files as they start with the name dot(.), if we “ls -a” inside /etc/skel directory
[root@siru lisa]# ls -a /etc/skel
o/p
. .. .bash_logout .bash_profile .bashrc .emacs .gtkrc .kde .screenrc
hence these are files copied from /etc/skel directory.
now you will know that we have never set a password for the user lisa, so the user lisa cannot login to the system as it doesn’t have any password, so we are setting password for the user lisa
[root@siru /]#passwd lisa
[Note: the root user is the only user that can change or set password for a user other than the self]
o/p
Changing password for user lisa New password:
type password for lisa
Re-Type password:
Retype password for lisa
passwd: all authentication tokens are updated successfully
password has been set and now lisa can login to the system using her account.
Alright, now we shall have a look into the htpasswd and htshadow files into the system.
cat /etc/passwd
o/p
jeevi:x:500:500::/home/jeevi:/bin/bash lisa:x:501:501::/home/lisa:/bin/bash
in the above output you could see that lisa is the username, x is the password which will be stored in /etc/passwd file, 501 is the user id, next 501 is the group id, (ya i said default as 100 but redhat linux will have a separate user private group it starts with 501, you will know that if you are familiar with group administration)net files is comment which is not set so the two colons(::) it can be filled by using useradd -c command /home/lisa is the default home directory of the user lisa, /bin/bash is the default shell for the user lisa.
Now, let’s have a look into htshadow file, the htshadow file will also have a separate line for each user
#cat /etc/shadow
o/p
jeevi:fdsfsfGD#$%%565GF$$$%^*:11758:0:99999:7::: lisa:Pfdefs@#4GFVtr33@334$ff:11768:0:99999:7:::
the first field of the above o/p is the user name and the next field is the encrypted version of the password just for security reasons.
Now let’s change a password for a bunch of users in a single command,
#pwlist
o/p
jeevi:siru lisa:lisa
#chpasswd < pwlist
o/p of above command will change all passwords for user for jeevi and lisa, but the file pwlist will have passwords for them in plain text format hence its safe to delete pwlist file, hence the after deleting pwlist file the passwords for users will only be present under /etc/passwd file(which is encrypted).
Now lets learn about groups.
The group id’s for users are stored under /etc/group
# cat /etc/group
o/p
jeevi:x:500: lisa:x:501:
again the first field specifies group name, next is group password which is stored at /etc/gshadow file, next is group id and next is the list of users in he group 500 which is empty which means that group jeevi has no users under it.
Let us consider that if some members are working on a project and have to access the files in common, say “projectX“, so we are now creating projectX group.
#groupadd -r projectX #cat /etc/group jeevi:x:500: lisa:x:501: projectX: x:11:
now we will add jeevi and lisa user into the projectX group this can be done by the following command
#usermod -G projectX jeevi
o/p
#cat /etc/group jeevi:x:500: lisa:x:501: projectX: x:11:jeevi
#usermod -G projectX lisa
o/p
#cat /etc/group jeevi:x:500: lisa:x:501: projectX: x:11:jeevi:lisa
which means users jeevi and lisa are a members of the group projectX, so the files with group permissions set to projectX can be accessible by jeevi as well as lisa in common.
Now lets add user jeevi to projectX as well as projectY, this can be done by
#groupadd -r projectY #cat /etc/group jeevi:x:500: lisa:x:501: projectX: x:11:jeevi:lisa projectY:x:12:
#usermod -G projectX,projectY jeevi
o/p
#cat /etc/group jeevi:x:500: lisa:x:501: projectX: x:11:jeevi:lisa projectY:x:12:jeevi
now, user jeevi is a user of both projectX as well as projectY but lisa is only a member of projectX group.
Command to see the groups which a user is present is
#group
(i.e)
#group jeevi
O/P
jeevi: jeevi :projectX : projectY
Note that when ever you need to add an extra group for jeevi you need to specify all the group which jeevi wants to be else he will be removed from the other groups say you will be removed from projectX and projectY if you have not specified these two group then jeevi will be removed from these two groups.
File permssions(modes):
=======================
* There are separate permissions for user, group and other.
* #ls -l command shows modes
* Root and owner can change modes.
Every file has three types of modes(permissions) they are user(the actual owner of the file), group and other(all the users present in the system)
#ls -l
The above command will list the file permissions of files.
o/p
drwxr-xr-- root jeevi folder
The fields(i.e drwx) in the above output tells us d-directory,r-read w-write and x-execute permission for the owner(here its root).
The second field(r-x) in the above output tells us that the group user(here it is jeevi) has r-read and x-execute permissions for that folder so he cannot edit that folder like he cannot create or delete files inside that folder.
The third field(r–)in the above output tells us that the other user(say anyother user like lisa,apache, etc) has onlyr-read permission that means that he can only read the folder and cannot edit or execute that folder(to open a folder the user needs execute permission as this is disabled here he cant open the folder).
Changing file permissions:
===========================
To change the file permission you can use “chmod” command. chmod command has two formats they are
1.Symbolc mode.
2.Binary number mode.
1.Symbolic format here we use u(user),g(group),o(other)
Eg:
#chmod g+w filename
will allow group user have write permission to that file.
#chmod g-w filname
will stop the group user from writing/changng the file.
You can use symbolic format as below example as well
#chmod ug=rw filename
will make user and group to have read and write permission to that file hence there will be no access for others and no x-execute permission for user and group of that file.
2.Binary number mode uses the following sntax.
#chmod 754 filename
(where 7 is user permssion 5 is group permission and 4 is other user’s permission) which is represented in binary values as the number 7 comes with binary value “111=rwx” and then 5 with binary value “101=r-x” and 4 with “100=r–“.
Directory permissions
=====================
Directoies will have permissions like as follows
7=rwx(where the user will have full permission to the directory, he can add, delete the files inside the directory).
5=r-x(where the user can only read and execute the directory cannot modify the files in that directory).
0=—(No permissions, he cannot access the directory).
[Note: User cannot read the folder if he has the folder has only execute permission and not read permission and he cannot open the directory if he has only the read permission and not execute permission. So, you need at-least read and execute permissions for a directory to access and read it]
If a user have read and execute permission for a directory and no permissions at all for a file inside that directory then he cannot read that file, so both directory and file permissions have to be working on your favor so as to access that particular file inside the directory.
Okay, now let’s combine all the above topics and work to share files for different users.
Let us consider that some users are working on ProjectX where everybody working on ProjectX needs to access a common folder and edit files.
[root@siru home]#ls -l
drwxr-x--- 3 siru ProjectX 4086 Mar20 12:11:20 siru drwxr-x--- 4 lisa lisa 4086 Mar21 12:30:21 lisa
The user siru has group user as ProjectX and read and execute permission for group users, hence the users with ProjectX can access the directory siru, Now lets go inside siru’s directory and do an ls -l command
[root@siru home]#cd siru
[root@siru siru]#ls -l
O/P
drwxr-x--- 5 siru ProjectX 4086 Mar20 12:11:20 ProjectX
Here we have ProjectX folder has group user as ProjectX hence the users with ProjectX group can access the files under ProjectX folder. Now, let go inside ProjectX folder and do an ls -l.
[root@siru siru]#cd ProjectX
[root@siru ProjectX]#ls -l
O/P
-rw------- 1 siru ProjectX 64 Mar 21 12:20:21 Plans
Now, here is the mistake where the file “Plans” doesn’t have any permissions set for the group ProjectX hence the memebers of the ProjectX cannot access the contents of the file “Plans”. So, you need to set read and write permissions to “Plans” file so that users from group “ProjectX” can read or edit that particular file, this can be done as follows
[root@siru ProjectX]#chmod 660
[root@siru ProjectX]#ls -l
-rw-rw---- 1 siru ProjectX 64 Mar 21 12:20:21 Plans
Now, the users under group ProjectX can edit the file “Plans”.
Wait a minute do you know how the folder “ProjectX” had group permission as “ProjectX”, let me explain how to create a file/folder with other group permission, let us consider that we are logged in as siru user.
This will create a folder sample
[siru@siru ProjectX]#ls -lO/P
-rw-rw---- 1 siru ProjectX 64 Mar 21 12:20:21 Plans drwxr-xr-x 2 siru siru 4086 Mar 21 13:20:21 samplenow the group permission set here for sample folder is siru, you have to change that as follows
[siru@siru ProjectX]#chown siru.ProjectX sample [siru@siru ProjectX]#ls -lO/P
-rw-rw---- 1 siru ProjectX 64 Mar 21 12:20:21 Plans drwxr-xr-x 2 siru ProjectX 4086 Mar 21 13:20:21 sampleyou can also do this as below steps as well
[siru@siru ProjectX]#newgrp ProjectX [siru@siru ProjectX]#mkdir sample [siru@siru ProjectX]#ls -lO/P
-rw-rw---- 1 siru ProjectX 64 Mar 21 12:20:21 Plans drwxr-xr-x 2 siru ProjectX 4086 Mar 21 13:20:21 sampleSo, how to make a normal user a administrator of a group, let’s see now., it can be done by following commands
#gpasswd -A siru ProjectX[The capital A tells the system that the successive user is the administrator of that group so, after executing the previous command we will have siru as the administrator of ProjectX, he can add or delete users to ProjectX group].
# su siru[switching user from root to siru] #gpasswd -a ram ProjectXThe above command adds user ram to group ProjectX
#gpasswd -d lisa ProjectXThe above command delets user lisa from ProjectX
Now if we see the /etc/group file we won’t be having user lisa in ProjectX but user ram will be added in ProjectX
#cat /etc/groupO/P
#cat /etc/group jeevi:x:500: lisa:x:501: projectX:x:11:jeevi:ram projectY:x:12:jeeviWe can have user private groups as well so that if user siru wants only lisa to access his files then he can add user lisa as his group member this can be done as follows
#gpasswd -A siru siru#su siru[switching user from root to siru]
#gpasswd -a lisa siru
The above command will add user lisa to user siru’s private group. Hence lisa can access the files which are set read permissions for siru group. Something like this-rw-r----- 1 siru siru 64 Mar 21 14:15:00 test[Note: See to that lisa can enter in to the directory where the groups of siru has permissions to execute and read the particular directory].
Whof.. Long isn’t it. Let me know if i have gone wrong somewhere.
Reference: CBTNUGGETS video tutorials
Thank you for visiting helpinlinux.com
Apache errors and warnings
February 21st, 2011If your apache server stops and if you are getting the following errors when you restart apache services
[error] VirtualHost — mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
then you missed an port number entry in the virtual host entries in the main configuration file follow the steps to resolve the problem.
1.Goto apache configuration file
#vi /usr/local/apache/conf/http.conf
2.Locate the Virtual host which doesn’t have an port number specified in it and add the port number as below
Change the line from
VirtualHost xx.xx.xx.xx
ServerName servername.domain.tls
DocumentRoot /usr/local/apache/htdocs
to
VirtualHost xx.xx.xx.xx:80
ServerName servername.domain.tls
DocumentRoot /usr/local/apache/htdocs
This will fix the problem.
IF you are getting any warning messages as below
WARNING: MaxClients of 850 exceeds ServerLimit value of 700 servers,lowering MaxClients to 700. To increase, please see the ServerLimitdirective.
Open the configuration file and edit the line
ServerLimit 700
MaxClients 850
to
ServerLimit 850
MaxClients 850
You are getting this error message just because you have set the server to respond only 700 concurrent connections and the maximum client requests as 850.
Installing and compiling Json with php
February 21st, 2011Hi,
This post guides you to compile PHP with json in CentOS.
By assuming that you have already installed PHP in the system I am going to guide you the installation steps
Please run the following command to install json in the server.
#pecl install json
After completing the command please goto php.d folder
#cd /etc/php.d/
Then open a file with .ini extension probably json.ini.
#vi json.ini
Add the following in json.ini file for php to load json extension.
extension=json.so
Then restart you httpd service.
#/etc/init.d/httpd restart
This will compile PHP with json.
Thank you for visiting helpinlinux.com
Steps to upgrade PHP to 5.3.5 and MySQL to 5.1 in CentOS and RHEL
February 21st, 2011Hi,
The following steps will make you to upgrade PHP to 5.3.5 using remi repostries in CentOS and RHEL systems.
Preinstallation steps
=====================
Make a note of current PHP and MySQL versions by using the following commands
#php -v
#mysql –version
backup running MySQL databases by using the fllowing steps
#cp -arp /var/lib/mysql /var/lib/mysql.bak
then dump the mysql databases using the following command
#mysqldump -you root -p(password) –all-databases > dumpfilename.sql
You can also take version compatible downgrade dump to check for any missing file restoring by using the following command
#mysqldump -you root -p(password) –all-databases –compatible=mysql40 > versioncompatibledumpfilename.sql
Also backup your php.ini(PHP configuration) file
#cp -arp /etc/php.ini /etc/php.ini.back
Upgrading PHP
=============
Downloading Remi rpm
———————–
The below command will download and install remi rpms from source.
#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Downloading epel rpm
———————–
The below command will download and install epel-release rpms from source.
#rpm -Uvh http://dl.fedoraproject.org/pub/epel/5Server/i386/epel-release-5-4.noarch.rpm
Remove all old PHP rpms from yum by using the following command.
#yum remove php*
Now you are ready with the remi repostries installed with in the server to upgrade PHP.
Please provide the following command to install php and its modules from yum remi repostries.
#yum –enablerepo=remi install php php-common php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-gd php-mbstring php-mcrypt php-xml php-imap php-devel php-odbc php-bcmath php-ldap
After installing restart httpd services
#/etc/init.d/httpd restart
Now you will
You may get errors if your php cannot combine with lower versions of MySQL. So, you need to upgrade MySQL to 5.1
Please remove the older version of MySQL by removing mysql rpms
#yum remove MySQL
Now please install MySQL through remi rpms by following steps
#yum –enablerepo=remi install mysql mysql-server mysql-connector-odbc
The above command will install MySQL 5.1
To start mysql automatically on server restart please provide the following line which will start mysql on run levels 2, 3 and 5
#chkconfig –levels 235 mysqld on
Thats all now you have upgraded PHP and MySQL in the server to 5.3.5 and 5.1 respectively.
Check them by using the following commands
#php -v
and
#mysql –version
Please let me know if I have made errors, your comments corrects my mistakes.
Reference: http://www.if-not-true-then-false.com/2010/install-apache-php-on-fedora-centos-red-hat-rhel/
Thank you for visiting https://helpinlinux.com,