A Dose For Linux
Friday, June 4, 2010
How to Change Mysql Data Directory
Wednesday, December 9, 2009
How To Install Apache Server on Linux
Apache HTTP Server is an open source HTTP web server for Unix platforms (BSD, GNU/Linux, and UNIX systems), Microsoft Windows, and other platforms. The Apache HTTP Server is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.
Note: Here I am installing apache2.2 on Red Hat Linux 5
Download the following rpms:
#wget http://www.apache.org/dist/httpd/binaries/rpm/i386/httpd-2.2.3-1.i386.rpm
#wget http://www.apache.org/dist/httpd/binaries/rpm/i386/httpd-devel-2.0.59-1.i386.rpm
#wget http://www.apache.org/dist/httpd/binaries/rpm/i386/httpd-manual-2.0.59-1.i386.rpm
Installation:
Type the following command if you are using Rhel, Fedora or Centos.
# rpm –ivh httpd-2.2.3-1.i386.rpm
# rpm –ivh httpd-devel-2.2.3-1.i386.rpm
# rpm –ivh httpd-manual-2.2.3-1.i386.rpm
You can also use yum command to install the same, but you will need yum repository for that
Running Apache:
Now we need to start httpd daemon to get it working
# /etc/init.d/httpd start
You can stop the server at any time by
# /etc/init.d/httpd stop
After making changes to the configuration file of apache, you will need to restart the server:
# /etc/init.d/httpd restart
To restart Apache without aborting current connections
#etc/init.d/httpd graceful
To Start Apache on system startup:
#chkconfig httpd on
After making changes in httpd.conf you can check the configuration syntax.
#etc/init.d/httpd configtest
Verify the Installation:
Open http://localhost in your browser, It will open following page.
If you can see this, it means that the installation of the Apache web server on this System was successful. Default document root for Apache is /var/www/html.You may now add content to this directory and replace this page.
Friday, November 27, 2009
Installation of PhpMyAdmin
#cd /download
# wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.2.3/phpMyAdmin-3.2.3-all-languages.zip/download
Now we need to move the downloaded package to apache document root directory to make it accessible through web interface.
# mv phpMyAdmin-3.2.2-all-languages.tar.gz /var/www/html/
Extract the tar.gz file:-
# cd /var/www/html/
# tar –xvzf phpMyAdmin-3.2.2-all-languages.tar.gz
Rename exracted folder to phpmyadmin.
# mv phpMyAdmin-3.2.2-all-languages phpmyadmin
Change owner to apache user
# chown –R apache:apache phpmyadmin
# cd phpmyadmin
Now we need to create a config directory temporarily and give write access .
# mkdir config
# chmod 755 config
# cp config.sample.inc.php config/config.inc.php
Open web browser and point to the following URL.
http://192.168.10.2/phpmyadmin/setup
It will open the initial setup page clickon New Server in the Server Section.
Enter Hostname:- localhost # default(localhost)
Server port: 3306 #default(3306)
Server Socket: - /var/lib/mysql/mysql.sock #default (/var/lib/mysql/mysql.sock)
Connection type: tcp
PHP extension to use: Mysqli
Authentication type: cookie
User for config auth: root
Password for config auth: ******* #mysql root password)
Click on the Save button in the Configuration section and close the browser window
Move config.inc.php to phpmyadmin parent directory
# mv config/config.inc.php /var/www/html/phpmyadmin/
Delete the config directory as we don't need this directory anymore
# rm –rf /var/www/html/phpmyadmin/config
Finally phpmyadmin has been installed, point your browser to the following URL.
http://192.168.1.2/phpmyadmin
You should be able to login with your mysql user.
Thursday, November 26, 2009
MySql Installation on Linux Guide
Download the required packages.
http://mirror.cogentco.com/pub/mysql/MySQL-5.2/
Installing MySql :-
# rpm -ivh MySQL-devel-5.2.0-0.glibc23.i386.rpm
# rpm -ivh MySQL-client-5.2.0-0.glibc23.i386.rpm
# rpm -ivh MySQL-server-5.2.0-0.glibc23.i386.rpm
# rpm -ivh MySQL-shared-5.2.3-0.glibc23.i386.rpmc23
# /etc/init.d/mysql start
Starting MySQL [OK]
Note:- If you get any error or fail to start mysql.
# /etc/init.d/mysql start
Starting MySQL [Failed]
Ø Then Check the following things.
# sestatus
must be disabled
# vim /selinux/config
SELINUX=disabled
# /etc/init.d/iptables stop
#ps -ef | grep mysql
#kill -9 (pid of mysql process)
Now Start Mysql :
#/etc/init.d/mysql start
Starting MySQL [OK]
Copy the sample my.cnf file to /etc directory
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
Set Mysql root user password:
# mysqladmin -u root password mypassword
Login to Mysql Database server
# mysql –u root –pmypassword
mysql>
Once MySQL client is running, you should get the mysql> prompt. Type the following at this prompt:
mysql>show databases;
You will now get a list of databases like:
+----------------+
| Database |
+----------------+
| mysql |
| test |
+----------------+
2 rows in set (0.00 sec)
Let's create a database!
mysql> create database databasename;
Check databases:
mysql>show databases;
+-------------+
| Database |
+-------------+
|databasename |
| mysql |
| test |
+-------------+
Connecting to database:
mysql>use databasename;
Checking Tables:
mysql>show tables;;
Reading Tables:
mysql>describe tablename;
Show All data in Table:
mysql> SELECT * FROM tablename;
You will get the output something like:-
+-------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------+------+-----+---------+-------+
| abc | text | | | | |
| ghi | text | | | | |
+-------------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Deleting a database:
mysql>drop database databasename;
Deleting a table:
mysql>use databasename;
mysql>drop table tablename;
Creating Mysql User and setting permissions:
mysql> create user 'username'@'localhost' IDENTIFIED BY 'password';
mysql> grant all on *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
mysql> flush privileges;
Backup of Mysql Database:-
# mysqldump –u root –pmypassword databasename > databasename.sql
Restore Mysql database:
# mysql –u root –pmypassword databasename < style="">
Backup of single table in Mysql :-
# mysqldump –u root –pmypassword databasename tablename > tablename.sql
Restore of single table in Mysql :-
# mysql –u root –pmypassword databasename tablename < style="">
Installation of Nagios on Linux
Download the following packages
- nagios-3.0.1.tar.gz
- nagios-plugins-1.4.11.tar.gz
Verify the following installed packages:
gcc-3.4.6-8
compat-gcc-32-3.2.3-47.3
libgcc-3.4.6-8
compat-libgcc-296-2.96-132.7.2
compat-gcc-32-c++-3.2.3-47.3
gcc-c++-3.4.6-8
gd-2.0.28-5.4E
Create user and group for Nagios
# useradd nagios
# passwd nagios
# groupadd nagcmd
# usermod -G nagcmd nagios
# usermod -G nagcmd apache
Installation of nagios
# tar xvf nagios-3.0.1.tar.gz
# cd nagios-3.0.1
# ./configure --with-command-group=nagcmd --with-cgiurl=/nagios/cgi-bin
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# make install-webconf
Installion of nagios plugins:
# tar xvf nagios-plugins-1.4.11.tar.gz
# cd nagios-plugins-1.4.11
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install
Add nagios to start at boot:
# chkconfig --add nagios
# chkconfig nagios on
Nagios User Authentication:
# htpasswd -c /usr/local/nagios/etc/htpasswd nagiosadmin
Verify Nagios Configuration:
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Starting Nagios:
# /etc/init.d/nagios start
Login to web interface : http://localhost/nagios/
How to Change Mysql Data Directory
Here I am going to move my default mysql data directory (/var/lib/mysql on RHEL5) to a new directory /mysqldata. First, we mu...
-
Download the required packages. http://mirror.cogentco.com/pub/mysql/MySQL-5.2/ Installing MySql :- # rpm -ivh MySQL-dev...
-
Here I am going to move my default mysql data directory (/var/lib/mysql on RHEL5) to a new directory /mysqldata. First, we mu...
-
First thing we need to do is to download the latest phpmyadmin package you can download the package with wget command #cd /...