RPM remove error: specifies multiple packages

November 18, 2011    |   Posted by admin   |    Category: Linux Administration

You may receive an error message “error: packagename specifies multiple packages” while removing a package with “rpm -e package-name”, for example:

# rpm -e mysql-devel
error: "mysql-devel" specifies multiple packages

This is because the packages of both the architectures (32 and 64 bit) are installed  on the server i.e.

mysql-devel.i386
mysql-devel.x86_64

CentOS, Fedora will list the duplicate packages when you query them using RPM. It won’t list the architecture i.e.

# rpm -qa mysql-devel
mysql-devel
mysql-devel

To list the packages along with their architecture, use the –queryformat option while querying the package,

# rpm -q --queryformat "%{name}.%{arch}\n" mysql-devel
mysql-devel.i386
mysql-devel.x86_64

Now, remove the package you wish to, for example 32 bit package:

# rpm -e mysql-devel.i386
Comments Off on RPM remove error: specifies multiple packages

Nginx 502 Bad Gateway error

October 30, 2011    |   Posted by admin   |    Category: Linux Administration

My server went down today and after restarting, it came up with a “Nginx 502 Bad Gateway” message. At first I thought its something related to the Nginx service, so restarted the nginx service but immediately realized it wasn’t the case.

Nginx receives a request on port 80 and it then proxies the request to ‘localhost’ on port 8080 (in my case) where another service is configured on it. If no service is listening on port 8080, it results in a ‘Nginx 502 Bad gateway’ message. I immediately realized it was the Java service binded on port 8080 of my server and started it.

# java -jar /home/user/test.jar

The website was online immediately.

The Nginx proxy port is defined in the Nginx configuration file and different services could be binded to the proxy port depending on your setup. It could be

1) PHP-fpm
2) php_cgi
3) FastCGI

OR could be something else. You have to start the service listening on the proxy port to get your website/application online.

Comments Off on Nginx 502 Bad Gateway error

Unable to start SSH: /dev/null is not a character device

October 6, 2011    |   Posted by admin   |    Category: VPS Management

The “/dev/null is not a character device” message occurs in a VPS when an upgrade is performed and the /dev/null turns into a regular file.

# /etc/init.d/sshd restart
Restarting Secure Shell server: sshd failed!
/dev/null is not a character device!.

The /dev/null should be a character device as per the Linux standards. To fix the issue, remove the file

# rm -f /dev/null

Create the character device

# mknod /dev/null c 1 3

The file should look like follows:

# ls -la /dev/null
crw-rw-rw- 1 root root 1, 3 Oct  1 11:42 /dev/null

Now restart the sshd service

# /etc/init.d/sshd restart
Stopping sshd:              [  OK  ]
Starting sshd:              [  OK  ]
Comments Off on Unable to start SSH: /dev/null is not a character device

How to add a sub-domain in Plesk with www prefix?

September 17, 2011    |   Posted by admin   |    Category: Plesk Management

Generally, a sub-domain is not accessed using the www prefix i.e. you can access subdomain.domain.tld but not www.subdomain.domain.tld by default.

Solution:

To make a subdomain work with ‘www’ prefix on a Plesk server, you have to add a ServerAlias entry in the vhost configuration of the sub-domain and add an A record from Plesk.

Steps:

1. Create a vhost.conf file for the sub-domain

# cd /var/www/vhosts/domain.tld/subdomains/<sub-domain>/conf
# nano vhost.conf

and add a ServerAlias entry

ServerAlias www.subdomain.domain.tld

2. Add an ‘A’ record for the ‘www’ prefix of the sub-domain from
     Plesk -> Domains -> <domain.tld> -> DNS Settings -> Add Record

www.subdomain.domain.tld A 1.1.1.1

3. To apply the ServerAlias changes, run the websrvmng utility

# /usr/local/psa/admin/bin/websrvmng -a

4. Restart the webserver

# service httpd restart

Replace the subdomain/domain name and the 1.1.1.1 IP with the actual values.

Comments Off on How to add a sub-domain in Plesk with www prefix?

Howto: find the Linux kernel version?

September 2, 2011    |   Posted by admin   |    Category: Linux Administration

The ‘uname‘ command is use to determine certain system information in all the Linux/Unix flavours like CentOS, Ubuntu, Debian, Fedora, FreeBSD etc. With specific ‘uname’ options, you can display all the details of the current working kernel on the server.

To display the working kernel name, version, date and time, system architecture type etc, use:

# uname -a
Linux server.domain.tld 2.6.18-164.11.1.el5 #1
SMP Wed Jan 20 07:39:04 EST 2010 i686 i686 i386 GNU/Linux

To print only the kernel version along with it’s major and minor versions:

# uname -r
2.6.18-164.11.1.el5

To print the system architecture type i.e. whether the machine is 32 or 64 bit, use:

# uname -p
i686

The /proc/version file also contains the kernel information:

# cat /proc/version
Linux version 2.6.18-164.11.1.el5 (gcc version 4.1.2 20080704 
(Red Hat 4.1.2-46)) #1 SMP Wed Jan 20 07:39:04 EST 2010
Comments Off on Howto: find the Linux kernel version?