Month: June 2008

apt-get installation for Redhat based Linux

apt-get installation for Redhat based Linux

Introduction –  apt-get  is the  APT package handling utility. I am using  apt-get command for  my day to day activities, which is very handy tool on Debian/Ubuntu Linux. Which can be used for installing/updating or removing Debian package (.deb), updating system etc.  So I was thinking  about using  apt-get on Redhat (RPM) based Linux.  is there any way to use it? the answer is Yes!! there is way  to use  apt-get  on Redhat (RPM) based Linux.

root@localhost:~#rpm -ivh http://apt.sw.be/redhat/el4/en/x86_64/dag/RPMS/apt-0.5.15lorg3.2-1.el4.rf.x86_64.rpm

Add following mirror –

root@localhost:~# vi /etc/apt/sorces.list.d/os.list

repomd http://apt.sw.be redhat/el4/en/x86_64/dag/

root@localhost:~#

How to use apt-get –

root@localhost:~# apt-get upgrade

root@localhost:~# apt-get update

root@localhost:~#apt-cache  search  pkg_name

root@localhost:~#apt-get  install  pkg_name

root@localhost:~#apt-get  remove  pkg_name

Thanks
Ravi Bhure

How to install wordpress on Ubuntu Gusty 7.10

How to install wordpress on Ubuntu Gusty 7.10

Introduction – To install WordPress, you should have Apache, MySQL, and PHP installed on your Linux server(typical LAMP server). If you don’t have LAMP server installed yet, then there are plenty of tutorials out there that will help you install them. Note that this walk through will probably also work for recent versions of Debian/Ubuntu Linux.

How to install the wordpress package using apt-get –

root@ravi:~# apt-get install wordpress

If you get an error message that the package wordpress cannot be found, it is most likely because you do not have multiverse servers enabled for apt-get. Here’s how to add them. First, edit /etc/apt/sources.list

root@ravi:~# vi /etc/apt/sources.list

Add the following two lines (it doesn’t particularly matter where you add them, or even if you have duplicate lines).

deb http://us.archive.ubuntu.com/ubuntu/ gusty main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ gusty main restricted universe multiverse

Now tell apt-get to update its package list and you should be able to find wordpress.

root@ravi:~# apt-get update

Now try to install WordPress as shown above.  Next we have to configure Apache  for WordPress

root@ravi:~# vi /etc/apache2/apache2.conf

At the bottom of the file add the following lines:

Alias /blog /usr/share/wordpress
<Directory /usr/share/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
</Directory>

You can access WordPress  with URL http://yourdomain.com/blog/.  If you want it to go somewhere else, just adjust the path accordingly.

Now we have to tell Apache to reload its configuration files.

root@ravi:~# /etc/init.d/apache2 reload

Next, we are going to create a database in MySQL for WordPress to use. First, login to MySQL Server –

root@ravi:~# mysql -u root -p

If you have never used MySQL before, the default root password is blank. Now would be a good time to set one.

Next we are going to create a database for WordPress to use. I’m going to be very imaginative and name the database “wordpress”.

mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

Now we have to create a database user for wordpress. This part is important; you could just use the same user for all of your applications, but if something went wrong, you could lose all of your data. By creating a separate MySQL user for each application, you are limiting your damage. I’m going to be imaginative again and choose the name “wordpress_user” for the WordPress database user account. You might want to pick a better password than fluffy; that’s simply what I’m using for this demonstration.

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpress_db_user’@’localhost’ IDENTIFIED BY ‘password’ ;
Query OK, 0 rows affected (0.00 sec)

Now let’s make sure that these changes took:

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

We are done with MySQL now, so let’s quit.

mysql> quit;
Bye

Next we are going to modify WordPress’s configuration file to tell it about the database and user we just created for it. But first, we have to deal with a little idiosyncrasy. The Ubuntu WordPress package creates a symbolic link to /etc/wordpress/ for its configuration file, but we aren’t going to be using anything in /etc/ for our installation. So first, get rid of the symbolic link. Don’t worry, this is just deleting a link, it’s not actually deleting any files. The default wp-config.php will remain in /etc/wordpress/ if you really want it.

root@ravi:~# rm  /usr/share/wordpress/wp-config.php

Now copy the sample configuration over to the main configuration location.

root@ravi:~# cp /usr/share/wordpress/wp-config-sample.php /usr/share/wordpress/wp-config.php

Now let’s edit the configuration.

root@ravi:~# vi /usr/share/wordpress/wp-config.php

Remember the database name, user account, and password that we just set in MySQL? We are going to input these into the configuration file and save it.

define(‘DB_NAME’, ‘wordpress’); // The name of the database
define(‘DB_USER’, ‘wordpress_DB_user’); // Your MySQL username
define(‘DB_PASSWORD’, ‘password’); // …and password
define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this value

We’re almost done. Now we just use WordPress’s built-in installation script. Go to http://yourdomain.com/blog/wp-admin/install.php and follow the directions. Write down the auto-generated password it gives you.

Now we’re going to login to WordPress. Go to http://yourdomain.com/blog/wp-login.php and login with the account ‘admin’ and the password you just wrote down. Now everything is working! The first thing you should do is change the password to the admin account. This option can be accessed from the “Users” tab along the top of the screen.

We have one more thing to do. We’re going to install a plugin for WordPress called “Spam Karma”. This plugin will defend your site from comment spam, which is a much bigger problem than you’d realize, especially if your site starts getting really popular. Luckily, it’s very easy to install the plugin. Go to the plugins directory, download the plugin using wget, and unzip it.

root@ravi:~#cd /usr/share/wordpress/wp-content/plugins/
root@ravi:~#wget http://wp-plugins.net/sk2/sk2_final.zip
root@ravi:~#unzip sk2_final.zip

Now, go back into the admin console of your blog, go to the Plugins tab, and click on the Activate button next to Spam Karma.
That’s it; you’re done! Try writing your first post on WordPress, or configure your site’s look and feel.

Thanks
Ravi Bhure

Installing Zabbix (Server and Agent) On Ubuntu Gusty7.10

Installing Zabbix (Server and Agent) On Ubuntu Gusty7.10

Introduction –  Zabbix is a solution for monitoring applications, networks, and servers. With Zabbix you can monitor multiple servers at a time, using a Zabbix server that comes with a web interface (that is used to configure Zabbix and holds the graphs of your systems) and Zabbix agents that are installed on the systems to be monitored. The Zabbix agents deliver the desired data to the Zabbix server. This tutorial shows how you can install the Zabbix server and agent on a Ubuntu Gusty 7.10.

I will use the system SFPAZABBIX with the IP address 192.168.3.180 as the Zabbix server, and I’ll install a Zabbix agent on the same system –

The Zabbix server can store its information in a MySQL or PostgreSQL database. We use MySQL here, so we install the MySQL server and client first using apt-get –
root@ravi:~# apt-get install mysql-server mysql-client

Create a password for the MySQL user root (replace yourrootsqlpassword with the password you want to use) –
root@ravi:~# mysqladmin -u root password  yourrootsqlpassword

Installing apache2 php5 for web interface –

root@ravi:~# apt-get install apache2 php5 php5-gd

Afterwards, we can install the Zabbix server, Zabbix agent, and the Zabbix web interface with a single command –
root@ravi:~# apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent

Apt installation will be asked a few questions-

Like mysql root user password and Zabbix database password, give mysql root password there that we created already.

This should create a MySQL database called Zabbix.

Next we must edit the Zabbix agent configuration in /etc/zabbix/zabbix_agentd.conf.

Replace Server=localhost with Server=127.0.0.1 (to avoid lookup problems of localhost) and specify the hostname of the current system in the Hostname line.

root@ravi:~# vi /etc/zabbix/zabbix_agentd.conf

[…]

Server=127.0.0.1

[…]

Hostname=SFPAZABBIX

[…]

root@ravi:~#

Then we restart the Zabbix agent –

root@ravi:~# /etc/init.d/zabbix-agent restart

Finally, we must specify the password of our zabbix MySQL user in the Zabbix web interface configuration –

root@ravi:~# vi /etc/zabbix/dbconfig.php

<?php
$DB_TYPE=’MYSQL’;
$DB_SERVER=’localhost’;
$DB_DATABASE=’zabbix’;
$DB_USER=’root’;
$DB_PASSWORD=’mysqlrootpassword’;

?>

root@ravi:~#

Restart services for zabbix server & agent –

/etc/init.d/zabbix-server restart

/etc/init.d/zabbix-agent restart

That’s it. you can access  Zabbix  webbased admin panel check URL http://SFPAZABBIX/zabbix or http://192.168.3.180/zabbix
>zabbix1

Afterwards, go to Configuration TAB and configure Zabbix!
zabbix2
If you have problems with Zabbix, please check the Zabbix logs – * /var/log/zabbix-agent/zabbix_agentd.log
* /var/log/zabbix-server/zabbix_server.logThe Zabbix configuration files for the server, agent, and web interface are as follows –

* /etc/zabbix/apache.conf
* /etc/zabbix/dbconfig.php
* /etc/zabbix/zabbix_agentd.conf
* /etc/zabbix/zabbix_server.conf

Taking backup of Zabbix server database using below script –

#!/bin/bash
# script for dumping the contents of a zabbix MySQL database
# this script will create a compressed mysqldump of the specified database
savePath=/zabbix/
fileName=”ZabbixDBbackup” # filename for the backup note the
dateVar=$(date +%Y-%m-%d) # date variable to append to filename
mysqldump -u root -p(mysqlpassword) zabbix | gzip > $savePath$fileName-$dateVar.gz

Schedule cronjob for Zabbix is as follows –

@daily /bin/sh /zabbix/backupforzabbix.sh         #zabbix db backup daily midnight

Append existing zabbix db backup on zabbix db –

Go to where is the zabbix db backup path ( i.e. /zabbix), check date & go for newer date when zabbix was running in good condition.
(ls -l commands output give you the newer date)

Unzip the compressed file and rename it to dbfilename.sql  (with sql extension)

Now go to mysql CLI prompt –

root@ravi:~# mysql -u root -p

mysql> use zabbix;

mysql> \. filename.sql

above command append the tables of zabbix database.

Thanks
Ravi Bhure