ProFTPD updated to version 1.3.5a

Following announcement of ProFTPD version 1.3.5a CentAlt rpm has been updated.

Tagged with: , ,

Postgres 9.4 failed to start in container – How to Fix

After upgrading Postgres to version 9.4 in VM using container service failed to start with following message:

 /etc/init.d/postgresql start
[....] Starting PostgreSQL 9.4 database server: main[....] The PostgreSQL server failed to start. ...
 FATAL: could not open shared memory segment "/PostgreSQL.1804289383": Permission denied ... failed!

Quick search pointed to lack of shared memory, but I had more than enough.

It turned that fix is to change dynamic_shared_memory_type from posix to none.

vi /etc/postgresql/9.4/main/postgresql.conf
dynamic_shared_memory_type = none 

and I was able to start

/etc/init.d/postgresql start
[ ok ] Starting PostgreSQL 9.4 database server: main.


Tagged with: ,

Centos 7 how to fix -bash: ifconfig: command not found

If you installed CentOS 7 minimal you might see following error message when you try to use ifconfig to see your ip address:

[root@localhost ~]# ifconfig
-bash: ifconfig: command not found

If you search for the package it is in net-tools package

[root@localhost ~]# yum search ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
=================================================================== Matched: ifconfig ====================================================================
net-tools.x86_64 : Basic networking tools

In case you do not want to install additional package and simply to see your ip address you can use ip addr command

[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:eb:6b:89 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic enp0s3
       valid_lft 85578sec preferred_lft 85578sec
    inet6 fe80::a00:27ff:feeb:6b89/64 scope link
       valid_lft forever preferred_lft forever

To install ifconfig

[root@localhost ~]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                            Arch                            Version                                           Repository                     Size
 net-tools                          x86_64                          2.0-0.17.20131004git.el7                          base                          304 k

Transaction Summary
Install  1 Package

Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm                                                                                      | 304 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                              1/1
  Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                              1/1

  net-tools.x86_64 0:2.0-0.17.20131004git.el7


and then you can use it

[root@localhost ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::a00:27ff:feeb:6b89  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:eb:6b:89  txqueuelen 1000  (Ethernet)
        RX packets 11316  bytes 14098176 (13.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3224  bytes 264337 (258.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Tagged with: , , ,

How to solve timeout in phpMyAdmin

phpMyAdmin is a tool written in php intended to handle administration of MySQL servers over the web interface.
When trying to import large SQL dumps you might see following message:

Maximum execution time of 300 seconds exceeded

If you are running on local host or host you manage the solution is to edit \phpmyadmin\libraries\config.default.php file and change
$cfg['ExecTimeLimit'] = 300;
$cfg['ExecTimeLimit'] = 0;

This will allow you to remove the limit.

In case you do not have access to configuration file (and your provider does not want to apply this change even if you ask nicely) only solution is to split one large file to several smaller files using text editor and add them one by one.
Note: The size of the file varies from host to host and should be determined by the method of trial and errors.

Tagged with: , , , ,

zfs-import-cache.service fails on startup – How to Fix

Recently I’ve upgraded ZFS on Linux to 0.6.3 on my CentOS 7 server.

After reboot my pool was not available and I was only capable to force the import.
In the logs I had:

Oct 24 10:26:33 hs kernel: SPL: using hostid 0x00000000
Oct 24 10:26:34 hs zpool: cannot import 'tank': pool may be in use from other system
Oct 24 10:26:34 hs zpool: use '-f' to import anyway
Oct 24 10:26:34 hs systemd: zfs-import-cache.service: main process exited, code=exited, status=1/FAILURE
Oct 24 10:26:34 hs systemd: Failed to start Import ZFS pools by cache file.
Oct 24 10:26:34 hs systemd: Unit zfs-import-cache.service entered failed state.

After quick search on the Internet I found that I’m not alone.
Original thread is here:
The fix for me was to create hostid:

dd if=/dev/urandom of=/etc/hostid bs=4 count=1
Tagged with: , ,

Linux how to empty root email

If you are administering nix server you’ve probably noticed that root account is used by default for many system emails.

If you did set email forwarding you already received them, but in case you did not the folder continues to grow and it can get thousands of emails.
Cleaning all those email via mail client is at least time consuming.

If you do not want any of those messages you can speedup the process by typing following command:

> /var/spool/mail/root
Tagged with: ,

CentOS 7 how to install LAMP

With my new server I wanted to install LAMP stack so I can test WEB applications locally. Just to note that in CentOS 7 it is not exactly classic LAMP (Linux Apache MySQL PHP), but new LAMP ( Linux Apache MariaDB PHP).

As in most package oriented OS Installation of LAMP on CentOS 7 is generally simple and consist of running following commands:

0. Update you system and add EPEL repo

sudo yum update
sudo yum localinstall --nogpgcheck

1. Install packages

sudo yum install httpd mariadb-server mariadb php php-mysql php-gd php-pear php-xml php-bcmath php-mbstring php-mcrypt php-php-gettext

If you need additional php modules just add them.

2. Enable services

sudo systemctl enable httpd.service
sudo systemctl enable mariadb.service

3. Start services

sudo systemctl start httpd.service
sudo systemctl start mariadb.service

4. Secure MariaDB installation

sudo /usr/bin/mysql_secure_installation

5. Open firewall ports

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

5. Test components

To test PHP and apache installation create new php script

vi /var/www/html/phptest.php

Put following code inside:
< ?php phpinfo(); ?>

And visit your ip addres/phptest.php with a browser.

6. Install phpMyAdmin

sudo yum install phpMyAdmin

7. Configure phpMyAdmin to allow connections

vi /etc/httpd/conf.d/phpMyAdmin.conf

Comment out curent

<directory /usr/share/phpMyAdmin></directory>

And add

<directory /usr/share/phpMyAdmin>
        AllowOverride none
        Options none
        Require all granted

Restart Apache
sudo systemctl restart httpd.service

and visit
your ip addres/phpMyAdmin

You should be able to login with you root account

Tagged with: , , , , ,

CentOS 7 how to change hostname

After I’ve created my home server I’ve tried to change it’s host name by going to /etc/sysconfig/network. For my surprise it was empty. Then I’ve recalled that in version 7 CentOS started using systemd. Hence the location changed.
New place to edit is /etc/hostname

The inconvenience of editing file directly is that system reboot is required to apply the change.

Alternative method is to use Network Manager tool by invoking nmtui.

Network Manager TUI

Change hostname via Network Manager TUI

and then execute:
systemctl restart systemd-hostnamed

You can type hostname to validate the change.

Tagged with: ,

How to create bootable USB key for CentOS 7 installation

CentOS 7 is out and I wanted to test it on real hardware. Unfortunately most of current methods to transfer bootable ISO to USB key in MS windows environment do not work (see quote below) or boots, but does not recognize installation media in case of Fedora LiveUSB Creator (suggested in RHEL 7 Installation guide).

CentOS 7 installer image has a special partitioning which, as of July 2014, most Windows tools do NOT transfer correctly leading to undefined behavior when booting from the USB key. Applications known (so far) to NOT work are unetbootin and “universal usb installler”.

After applying method of trial and errors I’ve discovered that best tool to transfer ISO to USB key is Win32DiskImager.
Note: Writing ISO image to USB drive overwrites all data on the drive.
Put the path to downloaded ISO image in image file(1), choose USB key drive letter (2) and press write(3).
Now you are ready to boot and install from your USB key.

Tagged with: , , ,

CentOS – how to disable IPv6 without restart

In case you need to disable IPv6 and cannot afford to restart here are the commands to quickly do it for CentOS:

echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf

sysctl -p

Tagged with: ,