Archive for December, 2010

LAMP Server

This guide will help you that how to set up a LAMP server on Ubuntu/ Debian Operating System

Apache 2 –  ­ Linux Web server
MySQL 5  – MySQL Database Server
PHP4/5 ­  – PHP Scripting Language
phpMyAdmin – Web­based database admin software.

Note: Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server.

First, let us prepare a system that has a minimum requirement of Debian/Ubuntu version of linux with atleast 256MB of RAM available. Anything less than this minimum ram will cause lot of problems since we are running a server along especially mysql and webmin requires lot of RAM to run properly. Mysql will give you this nasty error “cannot connect to mysql.sock” if you dont have enough memory in your server.

Before proceeding to install, update the necessary packages with debian with this command.

apt-get install update


Installing Apache + PHP

Apache is one of the most famous web server which runs on most linux based servers. With just few commands you can configure apache to run with PHP 4 or PHP 5.

If you want to install PHP 4, just apt-­get

apt-get install apache2 php4 libapache2-mod-php4

To install PHP5, just run the following on linux shell. Note that if you dont specify packages with ‘4’, PHP5 will be automatically installed.

apt-get install apache2 php5 libapache2-mod-php5

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www.

To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function exactly as shown below

Point your browser to http://ip.address/test.php or http://domain/test.php and this should show, all your php configuration and default settings. You can edit necessary values or setup virtual domains using apache configuration file

Installing MySQL Database Server

Installing mysql database server is always necessary if you are running a database driven ecommerce site. Remember running mysql server to a fair extend requires atleast 256mb of RAM in your server. So unless you are running database driven sites you dont absolutely need mysql. The following commands will install mysql 5 server and mysql 5 client.

apt-get install mysql-server mysql-client php5-mysql

Note: If you have already installed php4, you should make a slight change like this.

apt-get install mysql-server mysql-client php4-mysql

The configuration file of mysql is located at: /etc/mysql/my.cnf


Creating users to use MySQL and Changing Root Password

By default mysql creates user as root and runs with no passport. You might need to change the root password.
To change Root Password

mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD(‘new-password’) WHERE user=’root’;
mysql> FLUSH PRIVILEGES;

You must never use root password, so you might need to create a user to connect to mysql database for a PHP script. Alternatively you can add users to mysql database by using a control panel like webmin or phpMyAdmin to easily create or assign database permission to users. We will install Webmin and phpmyadmin during later once we complete basic installation.

PhpMyAdmin Installation

PhpMyAdmin is a nice web based database management and administration software and easy to install and configure under apache. Managing databases with tables couldnt be much simpler by using phpmyadmin

To install phpMyAdmin

apt-get install phpmyadmin

The phpmyadmin configuration file is located at: /etc/phpmyadmin directory

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf:

Now restart Apache

/etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin



Peer to Peer Connectivity

In some time you may want to transmit huge data , share your resources in between two systems. For that purpose you can use peer to peer (p2p) connection. To Connect two systems  in ubuntu, follow this procedure

1.Make ensure that the two systems are connected with the Ethernet cable properly.

2.Open terminal in root user mode

3. To Open network connection, use the command nm-connection-editor

netywork connection

4. Click Add button under the wired tab

network connetions

5. In the Editing wired connection window , click the IPv4 Settings tab, then select the Manual in Method drop down box.

6. Click Add button and fill the Address,Netmask, Gateway as per your network. Here i am going to use class C address ( Don’t mind about Public and Private IP address)

Address : 197.10.10.1

Netmask : 255.255.255.0

Gateway : 197.10.10.250

Enable the Available to all users check box, Then click the apply button.

7. Do the Same operation in the another system. Except the ip address allocation. Use the Different ip address , because if you are using same ip address , then the ip conflicts problem arises.

Address : 197.10.10.2

Netmask : 255.255.255.0

Gateway : 197.10.10.250

8. Now the Connection is established. You can perform your operation.

Debian

Debian is a free operating system (OS) for your computer. An operating system is the set of basic programs and utilities that make your computer run. Debian uses the Linux kernel (the core of an operating system), but most of the basic OS tools come from the GNU project; hence the name GNU/Linux.

Debian GNU/Linux provides more than a pure OS: it comes with over 25000 packages, precompiled software bundled up in a nice format for easy installation on your machine.

The latest stable release of Debian is 5.0. The last update to this release was made on November 27th, 2010. Read more about available versions of Debian.

Mandriva

Mandriva is a publisher of free software including :

Mandriva is also ‘Assembly‘ the meeting point of all users communities, developers and contributors of its projects.

Ubuntu

Ubuntu is an entirely open source operating system built around the Linux kernel. The Ubuntu community is built around the ideals enshrined in the Ubuntu Philosophy: that software should be available free of charge, that software tools should be usable by people in their local language and despite any disabilities, and that people should have the freedom to customize and alter their software in whatever way they see fit. For those reasons:

  • Ubuntu will always be free of charge, and there is no extra fee for the “enterprise edition,” we make our very best work available to everyone on the same Free terms.
  • Ubuntu includes the very best in translations and accessibility infrastructure that the free software community has to offer, to make Ubuntu usable for as many people as possible.
  • Ubuntu is released regularly and predictably; a new release is made every six months. You can use the current stable release or the current development release. Each release is supported for at least 18 months.
  • Ubuntu is entirely committed to the principles of open source software development; we encourage people to use open source software, improve it and pass it on.