Archive for the ‘Linux’ category

How To Install ImageMagick for Linux

November 24th, 2009

1. To install ImageMagick you will need to log in to your server or webspace with SSH.
From the command line first download and unzip the source:
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz

img1

2. Next type, tar -xzvf ImageMagick.tar.gz

img2

3. Next type, cd ImageMagick-6.2.6

img3

4. The following commands will install ImageMagick into your home directory.
–without-Perl and –without-ttf will disable Perl and TrueType support; without
these switches the install will fail. /path/to/your/htdocs/im should be replaced
with the actual path to your home directory, and the last part, IM, can be changed
to anything. The command “pwd” will tell you the present working directory.

./configure –prefix=/path/to/your/htdocs/im –without-perl –without-ttf

img4

5. Next type, make

img51

6. Next type, make install

img6

When these steps are completed ImageMagick will be installed in your home directory.
Please note that since this is a non-standard location, you may have to modify the configuration of other programs that use it so that they can find it. Any executables will also not be on the default executable search path.

How To Change MySQL Root Password

November 17th, 2009

I’ve found that in my journies, the easist way to reset a mysql password, assuming you have SSH / Shell access is to log into the server and change it. To do this, you need to do the following;

1. Login to the server via SSH.

2. Once logged in, you’ll need to modify the my.cnf file to force your mysql to skip the grant tables. This will allow you to reset mysql so you can gain access without providing the password. One of the benefits of SSH access.

The my.cnf file will look like this;

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
#skip-grant-tables  <— This is the line we add. Remove the # to enable it. Once done remove that or place the # back into place.
[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

3. Now that you added this, reset mysql.

4. Once mysql is restarted, you can gain access to it directly by typing ;

$ mysql -u root

It may ask for a password, but you can ignore it.

5. Now that you are logged in, will need to access the mysql database;

use mysql;

6. Lastly, we need to change the password by running the following;

UPDATE user SET password=PASSWORD(‘newpassword’) WHERE user=’root’;

7. Now you can remove the line in the my.cnf that we added in step 2. Once you remove it, save the configuration and restart mysql.

That’s it. The password has been changed!

Accounts missing from WHM (Cpanel)

July 14th, 2009

If you notice that an account is missing from your WHM instance and you’ve already attempted to fix this by running /scripts/rebuildcpusers (you have tried this, correct?), then the issue lies in the /etc/trueuserdomains file. To correct this you will need to manually edit this file (using VI, Nano, Pico) and add the domain and the user account assigned to that domain. For example;

My user is Myuser(it really isn’t) and the domain is Mywebsite.com. I would edit this in the file by added it as such:

Mywebsite.com: Myuser

Once this is done, save the file and restart cpanel. Once you access WHM, the directory will appear again.

How to change default listening port for Vsftpd

July 8th, 2009

If you are running vsftpd in standalone mode (not Xinetd), add the “listen_port” directive in vsftpd.conf,like this:

listen_port=222

If you are running vsftpd from an inetd or xinetd program, this becomes an inetd or xinetd problem. You must change the inetd or xinetd configuration files (perhaps /etc/inetd.conf or /etc/xinetd.d/vsftpd).

Disable or Enable Directory Browsing or Indexing

March 25th, 2009

Browsing or indexing is an option that allows the contents of a directory to be displayed in the browser when the directory does not contain an index page.
For example, if you make an http call to a directory such as http://yourdomain.com/images/, it would list all the images in that directory without the need for an html page with links.


We will need to create a blank file called “.htaccess”. You can name it “htaccess.txt” while your editing it, then rename the file to “.htaccess” after the file is on your web server.

Disable Directory Browsing or Indexing

Type or copy and past the following line of text in to your blank file.
Note: I add the work “All” so that every folder in that directory follows the same rule.

Options All -Indexes

Enable Directory Browsing or Indexing

You can reactivate it by adding the following line to your .htaccess file:

Options +Indexes

Once this is added, the directory will fully index again.