Installing software from a source code is common practice in UNIX and Linux world. Some time this is preferred method because it gives all power and flexibility you need to optimize your software such as MySQL, PHP, and Apache etc. However, uninstalling files installed from a source code tar ball is a big headache.
Two methods can be used to uninstall files:
Method # 1: make command
Use command make uninstall or equivalent supported command, Read INSTALL or README file in source code file to find out more about this method.
# make uninstall
Sure, this method sounds very easy but not supported by all tar balls.
Method # 2: find command
(a) Make a list of all files on the system before installing software i.e. a pre-installation list of all files on your system.
find /* > packgetlist.b4
(b) Now install the software (use configure & make to compile it)
make make install
(c) Now make a list of all files on the system after installing software i.e. postinstall list
find /* > packagelist.after
(d) Next, compare both lists using the diff utility to find out what files are placing where. This list can be use to uninstall all files installed using source tar ball.
diff packagelist.b4 packagelist.after > package.uninstall.list
diff packagelist.b4 packagelist.after > package.uninstall.list
(e) After some time if you wish to uninstall files then you need to get list of files from package.uninstall.list file. Use following small for loop at shell prompt to remove all files:
for i in $(grep ">" package.uninstall.list | awk '{ print $2 }') do /bin/rm -fi $i done
A note about software installed by using apt-get
If you are using Debian / Ubuntu Linux, use following command to uninstall binary packages:
sudo apt-get remove {package-name}
An example of removing MySQL from ubuntu:
completely remove and clean MySQL installation ubuntu
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
see if anything depends on the installed packages
apt-cache rdepends mysql-server
apt-cache rdepends mysql-client
rm -rf /etc/mysql
check to see if mysql is running:
service mysql status
Want to know service status;
service packagename status -----------------installation of mysql--------------
First, install the MySQL server and client packages:
sudo apt-get install mysql-server mysql-client
When done, you have a MySQL database read to rock 'n roll. However, there's more to do.
You need to set a root password, for starters. MySQL has it's own user accounts, which are not related to the user accounts on your Linux machine. By default, the root account of the MySQL Server is empty. You need to set it. Please replace 'mypassword' with your actual password and myhostname with your actual hostname.
sudo mysqladmin -u root -h localhost password 'mypassword' sudo mysqladmin -u root -h myhostname password 'mypassword'
Now, you probably don't want just the MySQL Server. Most likely you have Apache+PHP already installed, and want MySQL to go with that. Here are some libraries you need to install to make MySQL available to PHP:
sudo apt-get install php5-mysql
You can now access your MySQL server like this:
mysql -u root -p
Happy coding...;-)
No comments:
Post a Comment