Saturday, 21 July 2012

Change IP address on Ubuntu Server

If Your Ubuntu System has set to use DHCP, you will want to change it to a static IP address
sudo vi /etc/network/interfaces
If you are using DHCP for your primary network card which is usually eth0, you will see the following lines
auto eth0
iface eth0 inet dhcp
To change to static address change the dhcp to static as shown below
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Restart the neworking service using the following command
sudo /etc/init.d/networking restart

Wednesday, 22 February 2012

How to create a shortcut in Debian Linux desktop

creating a folder shortcut or application shortcut allows us to launch an application or open certain folders directly.
Using "Create Launcher"
>Right Click on desktop-->select "Create Launcher"


Sunday, 25 September 2011

How do I turn off the unread message count on the Windows XP login screen?

For current logged on user:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UnreadMail
For all users on the computer:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\UnreadMail
On the right pane, find a value data named MessageExpiryDays. If it’s not found, create a new DWORD key namedMessageExpiryDays. Set the value of “MessegaExpiryDays” to 0, and save the setting.

Thursday, 15 September 2011

Howto Install MySQL on Linux


Most of the Linux distro comes with MySQL. If you want use MySQL, my recommendation is that you download the latest version of MySQL and install it yourself. Later you can upgrade it to the latest version when it becomes available. In this article, I will explain how to install the latest free community edition of MySQL on Linux platform.
1. Download the latest stable relase of MySQL
Download mySQL from mysql.com . Please download the community edition of MySQL for your appropriate Linux platform. I downloaded the “Red Hat Enterprise Linux 5 RPM (x86)”. Make sure to download MySQL Server, Client and “Headers and libraries” from the download page.
• MySQL-client-community-5.1.25-0.rhel5.i386.rpm
• MySQL-server-community-5.1.25-0.rhel5.i386.rpm
• MySQL-devel-community-5.1.25-0.rhel5.i386.rpm
2. Remove the existing default MySQL that came with the Linux distro
Do not perform this on an system where the MySQL database is getting used by some application.
[local-host]# rpm -qa | grep -i mysql
mysql-5.0.22-2.1.0.1
mysqlclient10-3.23.58-4.RHEL4.1
[local-host]# rpm -e mysql –nodeps
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[local-host]# rpm -e mysqlclient10
3. Install the downloaded MySQL package
Install the MySQL Server and Client packages as shown below.
[local-host]# rpm -ivh MySQL-server-community-5.1.25-0.rhel5.i386.rpm MySQL-client-community-5.1.25-0.rhel5.i386.rpm
Preparing… ########################################### [100%]
1:MySQL-client-community ########################################### [ 50%]
2:MySQL-server-community ########################################### [100%]
This will also display the following output and start the MySQL daemon automatically.
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h medica2 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
Starting MySQL.[ OK ]
Giving mysqld 2 seconds to start
Install the “Header and Libraries” that are part of the MySQL-devel packages.
[local-host]# rpm -ivh MySQL-devel-community-5.1.25-0.rhel5.i386.rpm
Preparing… ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]
Note: When I was compiling PHP with MySQL option from source on the Linux system, it failed with the following error. Installing the MySQL-devel-community package fixed this problem in installing PHP from source.
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!
4. Perform post-install security activities on MySQL.
At a bare minimum you should set a password for the root user as shown below:
[local-user]# /usr/bin/mysqladmin -u root password ‘My2Secure$Password’
The best option is to run the mysql_secure_installation script that will take care of all the typical security related items on the MySQL as shown below. On a high level this does the following items:
• Change the root password
• Remove the anonymous user
• Disallow root login from remote machines
• Remove the default sample test database
[local-host]# /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer ‘n’.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
… Success!
By default, MySQL comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database…
… Success!
- Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
5. Verify the MySQL installation:
You can check the MySQL installed version by performing mysql -V as shown below:
[local-host]# mysql -V
mysql Ver 14.14 Distrib 5.1.25-rc, for redhat-linux-gnu (i686) using readline 5.1
Connect to the MySQL database using the root user and make sure the connection is successfull.
[local-host]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.1.25-rc-community MySQL Community Server (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
Follows the steps below to stop and start MySQL
[local-host]# service mysql status
MySQL running (12588) [ OK ]
[local-host]# service mysql stop
Shutting down MySQL. [ OK ]
[local-host]# service mysql start
Starting MySQL. [ OK ]

Installation - PhpAdmin

First things first, we need to get the latest version of phpMyAdmin, at the time this tutorial was written the latest stable version was 2.5.5-pl1, and you can get it at;
The phpMyAdmin Home Page
Grab the download, then grab a terminal window and do the following;
Change to the directory where you saved the downloaded file , such as;
$cd mydownloads


Cool, now we need to move the file to the root directory of your Apache webserver, which is usually/usr/local/apache/htdocs, also, root usually owns the Apache directory structure so you'll need to do the rest as root, so; 

$su 

$password 

Now, lets move the file to where we need it; 

#mv phpMyAdmin-2.5.5-pl1.tar.gz /usr/local/apache/htdocs 

Done, now make the Apache root directory your working directory; 

#cd /usr/local/apache/htdocs 

Cool, now lets unpack the file; 


#tar -zxf phpMyAdmin-2.5.5-pl1.tar.gz 

That will take a second, then, when the machine returns the prompt, do a directory listing; 

#ls 

You should see a new directory which has been created called phpMyAdmin-2.5.5-pl1, assuming you do go ahead and get rid of the original file; 

#rm phpMyAdmin-2.5.5-pl1.tar.gz 

Now, the new directory name is a bit long, and definatley not something you want to type in all the time, so lets make it easier; 

#mv phpMyAdmin-2.5.5-pl1 phpmyadmin 

Cool, now you've renamed the directory to something a little easier to remember, now make that your working directory; 

#cd phpmyadmin 

Configuration -

Now, what we need to do is edit the config.inc.php file so it works with your setup. So using vi, or whatever your favorite editor happens to be, open config.inc.php, find the following lines, and edit them as appropriate for your setup; 

$cfg['PmaAbsoluteUri'] = ''; (Default) 
$cfg['PmaAbsoluteUri'] = 'http://www.yoursite.com/phpmyadmin/'; (Edited) 

$cfg['Servers'][$i]['user'] = 'root'; (Default) 
$cfg['Servers'][$i]['user'] = 'your_MySQL_root_user'; (Edited) 

$cfg['Servers'][$i]['password'] = ''; (Default) 
$cfg['Servers'][$i]['password'] = 'your_password'; (Edited) 

Thats it, save the file and close it. 

Now, lets see if it works, open a browser and point it to phpMyAdmin by using your site info such aswww.yoursite.com/phpmyadmin, or, localhost/phpmyadmin if you are only working locally. If all is well you should see the welcome screen for phpMyAdmin !, if you don't, then check your logs and remember, Google is your friend. If you see a page full of PHP errors, make sure you used the correct username and password when you edited the lines mentioned above. 

Now, knowing what this cool program is capable of, its probably not something you want just anyone to be able to access, luckily we can take care of that very easily using Apache 's authentication process, so lets do it ! 

Still as root make a directory to store the password file we will be creating; 

#mkdir /usr/local/apache/passwd 

Now, lets create the file and add an allowed user; 

#/usr/local/apache/bin/htpasswd -c /usr/local/apache/passwd/authpass myphp 

htpasswd will prompt you for the password you would like to assign to this user, once entered, it will create the file authpass and populate it with the information for the user called myphp. You can use whatever names you like, this is only an example. 

Now the final step, change to your Apache configuration directory; 

#cd /usr/local/apache/conf 

And again using your favorite editor, open the file named httpd.conf and find the following section; 

Options FollowSymLinks AllowOverride None 

Directly under this section add the following (assuming you used the names from the example above); 

AuthType Basic AuthName "myphp" AuthUserFile /usr/local/apache/passwd/authpass Require user myphp 

Thats it, save the file and close it, then restart Apache by issuing the following command; 

#/usr/local/apache/bin/apachectl restart 

Perfect, now fire up your browser again and point it back to your phpMyAdmin site, this time you should be prompted for a username and password before being allowed access to the site. Enter the required information, and you are in business !.