Outline of the video:

  • Extracting the downloaded tar file to an appropriate directory of your system
  • Building the extracted files
  • “Hello World” program

Additional Tips not covered in the Video:

Running Python 3:

  • Launch the Terminal
  • Key in “python3” without quotes at the Terminal prompt. This should ideally launch Python 3.2.3

Note: The video instructs you to key in “python” at the Terminal prompt. This launches Python 2.7.3.

This is my first narrative video. So please be gentle with your comments. 🙂

Thank you for watching the video. I appreciate your time.

Advertisements

I thought I had to post this because of the way people tend to confuse with terminologies used in context with Selenium.

Courtesy to this post: “A Digression about Jargon” section @ http://www.aosabook.org/en/selenium.html

  • Selenium Core is the heart of the original Selenium implementation, and is a set of JavaScript scripts that control the browser. This is sometimes referred to as “Selenium” and sometimes as “Core”.

  • Selenium RC was the name given to the language bindings for Selenium Core, and is commonly, and confusingly, referred to as just “Selenium” or “RC”. It has now been replaced by Selenium WebDriver, where RC’s API is referred to as the “Selenium 1.x API”.

  • Selenium WebDriver fits in the same niche as RC did, and has subsumed the original 1.x bindings. It refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just “WebDriver” or sometimes as Selenium 2. Doubtless, this will be contracted to “Selenium” over time.

Back again after a long pause. I was in process of installation of Netbeans 7.1.2 yesterday (about half an hour back before this post :). Its 12:07 in the midnight when I’m keying in this post).

Every time I tried to run the Netbeans installer, I came across the warning message stating that the JDK was not detected. I exit the installation wizard, made a couple of restarts after running the apt-get updates in the terminal. However, the installer fails to detect the JDK installed in the system.

Note: The JDK installed in in Ubuntu 12.04 by default is OpenJDK.

Then finally concluded that will go ahead installing the tried/tested/trusted Oracle-java JDK. There begins the problems. Initially downloaded an rpm package from the Oracle-java site. Extracted the files and copied/pasted them into usr/lib/jvm folder. The NetBeans installer still seemed to be reluctant in detecting the JDK. (Not sure if I was right with this approach).

Then tried converting it to .deb package using alien and still the package failed to dpkg. :(. After being done with all the those manual extractions, I was soon on a look out for an installer package or a method to install it from the terminal with auto-download.

It was then that I came across a couple of sites suggesting to add the repositories and then install the package which too began failing.

Then came this QA site which turned out to be a saver.

It initially asks us to clean up the junk and begin with a fresh installation and this was successful after hours of R&D.

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Hope this helps anybody with Ubuntu 12.04 to get over with the issue with installation of Oracle Java 7 and in turn set up IDE's such as NetBeans. I was able to proceed with the installation of NetBeans successfully thereafter.

Welcome back. Its been quite a while since I posted something here. Today I am gonna deal with configuration of APC Smart UPS (APC Back-UPS ES 650 in my case) in your Ubuntu machine.

This applies to all those “Smart UPS” of APC where your computer can monitor your UPS via a USB interface (which comes bundled along with the product). By default you get a Software CD namely PowerChute which is meant for Windows and OS X by MAC.

Let me point out that this works out well with even other Linux OSs. So you need not flip this post away. It is just that you might have to use the appropriate commands required by your Linux system which might or might not be different from Ubuntu commands.

So lets begin.

I hope all your items present in your Update Manager is up-to-date. Though I don’t find any reasons for this to cause any issues but it is always recommended you keep it updated as and when possible (this is my personal suggestion as well).

Open your Terminal window. (Applications > Accessories > Terminal)

Type in the following:

sudo apt-get install apcupsd

You might be prompted to enter your password. So enter it and hit return. (Never mind if those * characters do not appear while you are entering your password, its hidden for added security purpose).

Once the process is completed successfully, type in the following:

sudo gedit /etc/default/apcupsd

This must open the file in a gedit Text Editor window.

Find the following line:

ISCONFIGURED=no.
Now replace ‘no’ with ‘yes’ without quotes.

Save and close the file.

Now return back to your Terminal window.

Type in the following command:

sudo gedit /etc/apcupsd/apcupsd.conf

Now make the following changes in the text editor that has just opened:

Find the line:

UPSCABLE <some default value already exists here>

Replace that <default value> with usb.

So your line should now be read as:

UPSCABLE usb

Similarly make changes to all these lines so that they are read as follows:

UPSTYPE usb
DEVICE
BATTERYLEVEL 5
MINUTES 3
NETSERVER on
NISPORT 3551

Please note that some the parameters mentioned above could have the default values as I have mentioned above. So you need not make any changes to those parameters such as NETSERVER and NISPORT. And some the values such as BATTERYLEVEL and MINUTES can be set to the values of your convenience and your device specifications. However it is not suggested that you reduce the values to lesser than those that I have suggested above as the time and power remaining might not be sufficient for your system to complete the process of shutdown or hibernation. Hence you can always increase it, but not suggested to reduce it any further.

Once these changes are made, please save file and close the editor.
We will run a few more commands to verify the outputs.

Verify the Setup

Run the following in your terminal:

sudo apcupsd start
sudo apcaccess status

You could even restart your system and then run the commands to make sure that apcupsd is running.

Final Setup
Unplug the UPS and wait for the process to take place. In my case the system should initiate and complete the shutdown process when the battery level or the time remaining is 5% or 3 minutes.

If you are system is not able to complete the process before your battery runs out, you could increase the above set parameters to say 8% or 5 minutes suiting your UPS’s needs.

Monitoring your Power Management System the GUI way
Finally, to monitor your system the GUI way as in Windows you could install the gapcmon package. This even provides you with handy graphs as well.

Run the following command:

sudo apt-get install gapcmon

Restart your PC and then you can this application from Application > System Tools > APCUPSD Monitor.

Rest of the features in this application is self-explanatory.

So hope this helps you and you could be well prepared in cases of expected or unexpected power outages. Please drop in your comments/suggestions/doubts if any in the comment boxes below. I will do my best help you out in case of any issues.

Basic MySQL Commands

Posted: March 8, 2011 in MySQL Querying

I found a good source of pretty much all MySQL commands. It could be useful when you are busy programming with php and you get stuck trying to communicate with the DataBase.

A heads up to you in advance, I am as of now working on consolidation some of the PHP programming issues that you might encounter while you busy programming. I would be bringing out the issues as well as the solutions/workarounds for the same. Hopefully that should be done within a day or two. Till then continue going through the list of commands below.

To login (from unix shell) use -h only if needed.

# [mysql dir]/bin/mysql -h hostname -u root -p

Create a database on the sql server.

mysql> create database [databasename];

List all databases on the sql server.

mysql> show databases;

Switch to a database.

mysql> use [db name];

To see all the tables in the db.

mysql> show tables;

To see database’s field formats.

mysql> describe [table name];

To delete a db.

mysql> drop database [database name];

To delete a table.

mysql> drop table [table name];

Show all data in a table.

mysql> SELECT * FROM [table name];

Returns the columns and column information pertaining to the designated table.

mysql> show columns from [table name];

Show certain selected rows with the value “whatever”.

mysql> SELECT * FROM [table name] WHERE [field name] = “whatever”;

Show all records containing the name “Bob” AND the phone number ‘3444444’.

mysql> SELECT * FROM [table name] WHERE name = “Bob” AND phone_number = ‘3444444’;

Show all records not containing the name “Bob” AND the phone number ‘3444444’ order by the phone_number field.

mysql> SELECT * FROM [table name] WHERE name != “Bob” AND phone_number = ‘3444444’ order by phone_number;

Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’.

mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ‘3444444’;

Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’ limit to records 1 through 5.

mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ‘3444444’ limit 1,5;

Use a regular expression to find records. Use “REGEXP BINARY” to force case-sensitivity. This finds any record beginning with a.

mysql> SELECT * FROM [table name] WHERE rec RLIKE “^a”;

Show unique records.

mysql> SELECT DISTINCT [column name] FROM [table name];

Show selected records sorted in an ascending (asc) or descending (desc).

mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;

Return number of rows.

mysql> SELECT COUNT(*) FROM [table name];

Sum column.

mysql> SELECT SUM(*) FROM [table name];

Join tables on common columns.

mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;

Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO user (Host,User,Password) VALUES(‘%’,’username’,PASSWORD(‘password’));
mysql> flush privileges;

Change a users password from unix shell.

# [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password ‘new-password’

Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

# mysql -u root -p
mysql> SET PASSWORD FOR ‘user’@’hostname’ = PASSWORD(‘passwordhere’);
mysql> flush privileges;

Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“newrootpassword”) where User=’root’;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

Set a root password if there is on root password.

# mysqladmin -u root password newpassword

Update a root password.

# mysqladmin -u root -p oldpassword newpassword

Allow the user “bob” to connect to the server from localhost using the password “passwd”. Login as root. Switch to the MySQL db. Give privs. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> grant usage on *.* to bob@localhost identified by ‘passwd’;
mysql> flush privileges;

Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES (‘%’,’databasename’,’username’,’Y’,’Y’,’Y’,’Y’,’Y’,’N’);
mysql> flush privileges;

or

mysql> grant all privileges on databasename.* to username@localhost;
mysql> flush privileges;

To update info already in a table.

mysql> UPDATE [table name] SET Select_priv = ‘Y’,Insert_priv = ‘Y’,Update_priv = ‘Y’ where [field name] = ‘user’;

Delete a row(s) from a table.

mysql> DELETE from [table name] where [field name] = ‘whatever’;

Update database permissions/privilages.

mysql> flush privileges;

Delete a column.

mysql> alter table [table name] drop column [column name];

Add a new column to db.

mysql> alter table [table name] add column [new column name] varchar (20);

Change column name.

mysql> alter table [table name] change [old column name] [new column name] varchar (50);

Make a unique column so you get no dupes.

mysql> alter table [table name] add unique ([column name]);

Make a column bigger.

mysql> alter table [table name] modify [column name] VARCHAR(3);

Delete unique from table.

mysql> alter table [table name] drop index [colmn name];

Load a CSV file into a table.

mysql> LOAD DATA INFILE ‘/tmp/filename.csv’ replace INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’ (field1,field2,field3);

Dump all databases for backup. Backup file is sql commands to recreate all db’s.

# [mysql dir]/bin/mysqldump -u root -ppassword –opt >/tmp/alldatabases.sql

Dump one database for backup.

# [mysql dir]/bin/mysqldump -u username -ppassword –databases databasename >/tmp/databasename.sql

Dump a table from a database.

# [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

Restore database (or database table) from backup.

# [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

Create Table Example 1.

mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));

Create Table Example 2.

mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default ‘bato’);

Thanks for your interest in this site. I will try to bring in more and more interesting posts. Till then happy and adventurous programming.

Here are some simple steps that can be carried out to set up your Mobile Broadband in your Ubuntu 10.04 version.

Some of the advantages of this Mobile Broadband are :

  • It is mobile!!! as its name suggests.
  • No roaming charges (as of now).
  • Pretty reasonable speed. I have touched peaks of 150-170kB/s(i.e. about >1Mb/s) at times, not always.
  • Instant Activation.

Well I didn’t mean all praises to these companies. There are so many disadvantages/drawbacks as well which cannot be left out.

  • 1st of all, Unreasonable/Illogical tariff plans. You have a fair usage policy that limits your usage to 15GB a month for unlimited plans, and unlike BSNL or Airtel who cut down your speeds when you cross their fair usage limits(which are about 500GB or something), these mobile broadband companies charge you for the extra usage. So is it actually unlimited? I ended up paying a hefty bill of Rs.2900 last month!!!)
  • Horrible customer service – There is absolutely no regard for the feelings of the hapless customer.
  • Fluctuating speeds which irritates a lot a when you are browsing.

Anyways, griefs apart, lets get back to work.

1st of all I am assuming you already have some source of internet connection like you must be working on dual boot OS where you must be having windows installed or you are looking at this post from your friend’s place. (Else you wouldn’t be reading this blog right!?!). If possible get a copy of this post printed so that you can refer to at the time of set up. And u gotta get d following two packages already downloaded (again i mean you should have some prior access to internet as I mentioned above):

The default program in the device is only compatible with windows. So here we will instruct the Ubuntu machine to recognize the device as a Mobile Broadband device, whereas normally Ubuntu or any other linux distribution for that matter detects it as a usb-storage device.

This can be usually understood by creating a mobile broadband connection using Network Manager. Once plugged, the device will probably appear as a usb storage device, but it is important that your system and hence the network manager recognize it as a usb-modem.

Check if your device is being detected as a usb-modem
You can check it at the first step of creating a mobile broadband connection using Network manager.

    1. Right click on the Network manager icon and select “edit connections”.
    2. Now, go to “mobile broadand” tab and click on the add button.
    3. If the wizard shows you the name of the detected device, then congrats! otherwise you might need to take some extra measures to make that happen. In the screenshot below, the device is detected by NM.
New Mobile Broadband Connection

New Mobile Broadband Connection Wizard

The reason for your device not being detected as a usb-modem but a usb-storage device is best explained in the description of the package usb-modeswitch.

Several new USB devices have their proprietary Windows drivers onboard, especially WAN dongles. When plugged in for the first time, they act like a flash storage and start installing the driver from there. If the driver is already installed, the storage device vanishes and a new device, such as an USB modem, shows up. This is called the “ZeroCD” feature.

On Debian, this is not needed, since the driver is included as a Linux kernel module, such as “usbserial”. However, the device still shows up as “usb-storage” by default. usb-modeswitch solves that issue by sending the command which actually performs the switching of the device from “usb-storage” to “usbserial”.

So, you will have to install usb-modeswitch package. Since, we are dealing with Huawei EC 1261 here, I was able to get it to work with the latest usb-modeswitch package(version 1.1.2), rather than the one available in 10.04 repo(1.1.0).

Please note that, the usb-modeswitch package in Ubuntu 10.10, Meerkat’s repos are 1.1.4. So, direct installation from synaptic for Meerkat users, should work without any trouble.

Cont- for Ubuntu 10.04 or earlier – In order to install the latest version, you will have to download and install the squeeze(testing) packages from debian.

Let me request you, don’t try installing the debian packages by double-clicking on them and then installing them with the help of some package manager. This might not be effective enough (I won’t rule out its success though). So try using the following commands below in your terminal window.

sudo dpkg -i usb-modeswitch-data_20100418-1_all.deb

Note: See don’t just blindly copy paste the above commands. Replace the file names above with the recent versions you have downloaded and also mention the complete. In my case, the packages are assumed to be present in the current working directory. If for example if it is located on the desktop then replace “usb-modeswitch-data_20100418-1_all.deb” with “/home/revindran/Desktop/usb-modeswitch-data_20100418-1_all.deb” in the above command.

So your command could look something similar to this with the full path:

sudo dpkg -i /home/revindran/Desktop/usb-modeswitch-data_20100418-1_all.deb

Similarly follow the above steps for the following commands.

sudo dpkg -i usb-modeswitch_1.1.2-3_i386.deb

Now plug in usb-modem and this time your computer should be able to recognize it as a usb-modem. Go to the Network Manager follow the 1 steps which I have mentioned at the start of the process. Get your internet working. 🙂 This must work for about 75% users out there.

Those who unsuccessful, don’t lose hope. Please try the following steps further. Hopefully, this should get you started.

Run this command:

cd /etc/usb_modeswitch.d/

Then run the following:

ls | grep 12d1

This should give you the names of the files that have 12d1 in them.

Here is a screenshot of the results that I received.

checking the contents of 1446 file

checking the contents of 1446 file

Now plug in your device again and run the following command:

lsusb | grep 12d1

This will should give you a single line output. Read whats mentioned after “12d1:”, if its 140b, it should work directly, if its 1446 then you probably should try modifying a file.

Open the file, run this command

sudo gedit /etc/usb_modeswitch.d/12d1:1446

This will open the file in the text editor. Now, you will see a line in that file TargetProductList=”1001,1406,140c,141b,14ac”. Just add 140b to the list, save the file and try again. Restart if necessary(I would suggest you restart), plug in the usb and see in Network Manager if the device is detected and create the connection. Since, it was working earlier, it should work now too.

Again, if this doesn’t solve, try this last step out. Safely remove your device (I mean you right click and select the safely remove device option.). Then plug in your device back. Again check if it is detected in your Network Manager.

If it doesn’t still, do not lose hope. I myself had to try out till the following step. Again unplug the device safely and plug it in back. Now run the last and only remaining weapon (as far as my knowledge goes).

sudo usb_modeswitch -c /etc/usb_modeswitch.d/12d1:1446

You must get a result as shown in the screenshot below if successful.


For those who have obtained a result or similar as shown in the screenshot, click on the Network icon present in your panel (taskbar present at the top).

You must have something called as New mobile broadband connection or something similar. Click on it. Set up your network by following the wizard and happy browsing.

Those who are still unsuccessful, the last resort is upgrade your distro to Ubuntu 10.10 Maverick. That should help you run your device without much hassles. But before you begin with upgradation, just ensure that you have followed all the above steps without any fault. Only then proceed with your upgradation as a last resort because Ubuntu 10.10 is not meant to be a production environment. It is actually development environment. Instead try extending yourself till Ubuntu 11.04 releases which will again be production environment. However I did not mean that development environments are all that bad, but it would be slightly unreliable compared to the production environments.

So happy internetworking!!! Have a good day!!!

1st of all I’ll start with the creation of database

I will begin with the step to  start/open the MySQL Terminal/Prompt (Drop your comment below regarding the right usage of the terminology) because this is where most of the beginners end up with. I myself did get into this trouble wondering where to begin with.

Open your Terminal window of your Ubuntu desktop. Basic workflow for other Linux Desktops could also be the same except with slight variations.

You can do this by:
Click on Applications -> Accessories -> Terminal.

At the prompt type the following:
revindran@revindran-desktop:~$ mysql -u root -p

The ‘root’ in the above command should be replaced by the name if you have specified one at the time of installation. If you haven’t, then your root username is ‘root’.

You would be prompted to type the password of your MySql root.

Enter the password. Don’t worry if the asterisk(*) characters do not appear on your screen. It is hidden for added security.
Just type in the password and press ‘Return’ (‘Enter’) key of your keyboard.

Then comes your mysql prompt.
The following screenshot must give you a brief summary all you have done till now.

Starting MYSQL Terminal

Starting MYSQL Terminal

Congrats. You can now get started with your SQL querying now.

To create the Database.
Enter the following at the mysql prompt.

mysql> CREATE DATABASE trialDB;

It should output the following lines. Ignore the seconds:
Query OK, 1 row affected (0.00 sec)

So you are done with creation of a Database named trialDB.

Now to create the table in the Database that you just created.

Type ‘exit’ at mysql prompt without the quotes which should look something like this as shown below:

mysql> exit;
Bye

Now you are back to your terminal.
Now type the following in your terminal and press enter.

log into MySQL Database

log into MySQL Database that was just created

However note that I did read at certain sources that we could directly select the database by typing with following syntax without having to log out of the mysql prompt by typing exit.

mysql>use trialDB;

However this was throwing an error when I tried executing it. Sorry it is not possible for me to execute it again as I don’t have access to MySQL right now.
However if somebody could come out with an explanation, then please drop in your experience below in the comment box.

Ok. Let continue.

Now that you have selected the database, we will now create a table.

mysql> CREATE TABLE `trialTBLE` ( `member_id` int(11) unsigned NOT NULL,`member_name` varchar(200) NOT NULL) TYPE=InnoDB;

To learn more about the above query’s usage and syntax, follow this link:
Very good SQL Tutorial

Following must be the output of the above command executed. Ignore the seconds.
Query OK, 0 rows affected, 1 warning (0.08 sec)

Bingo so you are done. In the upcoming days, I will be posting on how to run these commands using PHP which would be quite interesting.

Also I would be posting a Utility post of SQL Querying which can come in handy to understand the structure of the Databases, tables and data that you maintain in the MySQL Database.

Till then have a blast. Don’t forget to drop in your doubts or easier methods if any in the comment box below so that it could be of help to somebody in need and I could learn from it as well.

Installing LAMP on Ubuntu

Posted: March 1, 2011 in Ubuntu, Web Designing

LAMP stands for Linux Apache Mysql Php. See… this is mainly targeted at the newbies. Anyways those EXPERIENCED as well do have a look at this. At times even when the experienced gets jammed at a particular area, it is always suggested to come back to basics. This approach nearly solves 90-95% issues.
So this Post is targeted at EVERYBODY!!! 😉

    Install Apache

To start off we will install Apache.

1. Open up the Terminal (Applications > Accessories > Terminal).

2. Copy/Paste the following line of code into Terminal and then press enter:

sudo apt-get install apache2

3. The Terminal will then ask you for you’re password, type it and then press enter.

    Now Test Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

1. Open up any web browser and then enter the following into the web address:

http://localhost/

You should see a folder entitled apache2-default/. Open it and you will see a message saying “It works!” , congrats to you!

    Install PHP

In this part we will install PHP 5.

Step 1. Again open up the Terminal (Applications > Accessories > Terminal).

Step 2. Copy/Paste the following line into Terminal and press enter:

sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:

sudo /etc/init.d/apache2 restart

    Now Test PHP

To ensure there are no issues with PHP let’s give it a quick test run.

Step 1. In the terminal copy/paste the following line:

sudo gedit /var/www/testphp.php

This will open up a file called phptest.php.

Step 2. Copy/Paste this line into the phptest file:

Step 3. Save and close the file.

Step 4. Now open you’re web browser and type the following into the web address:

http://localhost/testphp.php

The page should look like this:

Congrats!!! You have now installed both Apache and PHP!

    Install MySQL

To finish this guide up we will install MySQL. (Note – Out of Apache and PHP, MySQL is a bit confusing. So carefully follow the steps. )

Step 1. Once again open up the amazing Terminal and then copy/paste this line:

sudo apt-get install mysql-server

Step 2 (optional). See I wanna tell you an important thing. Carry out this step only if you have already made all the setup required for a server. Else if you are just looking forward to design and create php web server pages, then you better stop reading this step 2 here and continue with step 3.
In order for other computers on your network to view the server you have created, you must first edit the “Bind Address”. Begin by opening up Terminal to edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Change the line

bind-address = 127.0.0.1

And change the 127.0.0.1 to your IP address.

Step 3. This is where things may start to get tricky. Begin by typing the following into Terminal:

mysql -u root

Following that copy/paste this line:

mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘yourpassword’);

(Make sure to change yourpassword to a password of your choice.)

Step 4. We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

sudo gedit /etc/php5/apache2/php.ini

Now we are going to have to uncomment the following line by taking out the semicolon (;).

Change this line:

;extension=mysql.so

To look like this:

extension=mysql.so

Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart

The End

Quick note to anyone who encountered problems with setting up the MySQL password, please refer to this page: MysqlPasswordReset

I appreciate everybody who has taken the time to read this guide. This guide is also my first ever so I would love to hear back from you. Please don’t be harsh with your comments. Critics/comments/corrections/suggestions are always welcome.

If you have questions about installing any part of LAMP just drop them in the comment box and I will do my best to help you out.