Archive for the ‘Distributions’ Category

How to list installed packages on Debian?

Wednesday, May 13, 2015 posted by admin

To get a list of all installed packages on a Debian or Ubuntu server, run the command:

dpkg --get-selections

This command will show you a rather long list. To save the list to a file, use this command:

dpkg --get-selections > /tmp/packages.txt

the list is saved then in the file /tmp/packages.txt.

If you seek for a specificy package, use the grep command:

dpkg --get-selections | grep nginx

will show you all packages that contain the word "nginx" in their name.

Example:

root@sv1:/# dpkg --get-selections | grep nginx
nginx-common install
nginx-extras install

How to change the Hostname on CentOS 7

Sunday, April 12, 2015 posted by Till

The easiets way to change the hostname on CentOS 7 is to use the hostnamectl command.

First I will check the current hostname by running "hostnamectl status" on the shell of my server:

hostnamectl status

The output on my system is:

[root@server1 ~]# hostnamectl status
   Static hostname: server1.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: d89865d34b5a4637a9a4ff0ce0f6da02
           Boot ID: 56d1685056d743b39e57a7b9cbfe467c
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

Then I change the hostname with the set-hostname option of the hostnamectl command to server2.example.com

hostnamectl set-hostname server2.example.com

Afterwats I check with the command hostname and hostname -f if the hostname change has succeeded.

hostname
hostname -f

The result should be:

[root@server1 ~]# hostname
server2.example.com
[root@server1 ~]# hostname -f
server2.example.com

Instead of the hostname command you could also use the "hostnamectl status" command again to check if the new hostname has been set:

[root@server1 ~]# hostnamectl status
   Static hostname: server2.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: d89865d34b5a4637a9a4ff0ce0f6da02
           Boot ID: 56d1685056d743b39e57a7b9cbfe467c
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

The Following command can be used to check and repair all MySQL databases on a Ubuntu or Debian Linux System.

Ubuntu Linux

sudo mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases

Debian Linux

mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases

The benefot of the above comand is that it uses the debian-sys-maint login to MySQL which is available on every Debian and Ubuntu System, so you dont have to provide the MySQL root login details.

How to Copy Files with SCP between Linux Servers

Saturday, July 19, 2014 posted by Till

1.1 SCP Command Line-An Overview

 

The SCP command line is commonly used to copy files over SSH, and between popular Operating systems like Linux, Mac and Windows in a secure fashion. SCP is used to copy files to/from a remote server. It also allows you to copy files from one remote server to another remote server, without passing traffic through your PC.

Solution for: system-config-firewall: command not found

Wednesday, February 5, 2014 posted by admin

When you get the error message "system-config-firewall: command not found" on your CentOS Server while trying to configure the firewall on the shell, then the text interface version of the firewall configuration utility is missing. Install it with this command:

yum install system-config-firewall-tui

If your mail server stops working (neither incoming nor outgoing email works) and you find the following error message in the mail.log file:

fatal: open database /var/lib/postfix/smtpd_scache.db: File exists

then the smtpd_scache.db might got corrupted. Postfix will recreate this file, if it does not exist. So it can be removed to solve the issue:

/etc/init.d/postfix stop
rm -f /var/lib/postfix/smtpd_scache.db
/etc/init.d/postfix start

Thanks to Alexander Fox for sending me this FAQ.

Dovecot is watching the whole server filesystem for modifications and removed or added sub filesystems. If you get errors similar to this one on your server:

Aug 30 09:10:23 server1 dovecot: master: Warning: /var/www/clients/client1/web1/log is no longer mounted. If this is intentional, remove it with doveadm mount

 (the directory path may vary), then you can fix it by excluding the path from being watched by dovecot. In my case, dovecot shall not watch my website directories as they do not contain any mailboxes

Run the following command on the shell as root user:

doveadm mount add '/var/www/*' ignore

To exclude all files and folders in /var/www from deovecot monitoring.

 

Incorrent Time on Windows/Linux Dual Boot System

Monday, April 22, 2013 posted by CSch

If you work on a dual boot system you might experience that when you log off from Windows, onto Linux, and to Windows again, the time that is shown in the bottom right corner might be an hour or more off the actual time. This will correct once you refresh it by loading the time from a time server again but will remain an issue for the next logins.
This has not directly to do with daylight savings or an incorrect time zone, but most likely with Linux assuming that the BIOS time is set to UTC while it's set to local time. So it just changes the BIOS clock according to that. Logging in to Windows with the wrong BIOS clock will result in a wrong system time.

This Linux behavior can easily be changed though, so just login to your Linux system and open a command line. First log in as root with your password:

sudo su

Then enter following to open the rcS file (note that I use vi as text editor - you can use any other you like here):

vi /etc/default/rcS

Now look for the line reading UTC = yes and change it to UTC = no. Save the file and try to boot into Windows - if every other time setting is set correct you should get the right time now.

Install Steam on Ubuntu and Linux Mint

Saturday, March 16, 2013 posted by CSch

With Steam support for Linux, there will most likely be a whole lot more games coming out for Ubuntu and its consorts. While the database of games with Linux support still grows, many titles are already available.
To install Steam on Ubuntu or Linux Mint, open a Terminal and enter the following commands:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B05498B7
sudo sh -c 'echo "deb http://repo.steampowered.com/steam/ precise steam" >>
/etc/apt/sources.list.d/steam.list'

 

sudo apt-get update
sudo apt-get install steam

Afterwards start it with

steam

Screenshot at 2013-03-12 12:16:05

If you get error messages from amavisd similar to the one posted below on a server which is virtualized with OpenVZ:

Mar  5 09:09:02 v100 amavis[17378]: (17378-14) (!!)TROUBLE in process_request: Error writing a SMTP response to the socket: Broken pipe at (eval 100) line 987, <GEN44> line 31.

then the issue can be caused by the NUMTCPSOCK value in the openvz limits. Even if the barrier of this limit was never met in /proc/user_beancounters, the above error occurs when more then 25% of all TCP sockets were used. The solution is to set the NUMTCPSOCK barrier and limit to a high value in the openvz container configuration file. Here a value that worked for me on a moderately used mailserver:

NUMTCPSOCK="2000:2000"

Finally restart the OpenVZ VM to apply the new limit value.