Category: Linux

Linux Tips and tricks, either for desktop or internal system.

Apache, Linux, Wordpress

Customizing apache2-suexec-custom

Apache2 Suexec module comes with at least 2 flavors in many distributions of Linux. – apache2-suexec-pristine: Apache HTTP Server standard suexec program for mod_suexec – apache2-suexec-custom: Apache HTTP Server configurable suexec program for mod_suexec Many times when I’ve been trying to use the standard mod_suexec with mod_fcgi (useful for WordPress installations),the mod_suexec complains that the …

Bash, Linux

Finding the absolute path of a running script

In bash scripts we often need to know in which directory the running script is found especially when the script is in the $PATH and may be occurring in multiple places: Here is a reliable way to find it out: Based on this site: http://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself # Absolute path to this script. /home/user/bin/foo.sh SCRIPT=$(readlink -f $0) …

Linux, Wordpress

Installing wp_cli

wp_cli is a really good PHP script which helps installing the latest WordPress version in an htdocs. Here is how to install it in a Linux system: This will install wp_cli PHP script as /usr/local/bin/wp in the system. (Logged in as root) cd /tmp wget https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod 755 wp-cli.phar mv wp-cli.phar /usr/local/bin/wp To get the …

Apache, Linux, Security

Installing VSFTPD for FTP-SSL web sites upload on Ubuntu

In order to force an exclusive use of the SSL/TLS connectivity to users here is how to install it: Note: This tutorial was base from this site: https://www.digitalocean.com/community/tutorials/how-to-configure-vsftpd-to-use-ssl-tls-on-an-ubuntu-vps Install the vsftpd package sudo apt-get install vsftpd Edit the /etc/vsftpd.conf configuration file and add the following at the end of the file or alternatively adapt the …

GlusterFS, Linux

Installing GlusterFS 3.6 in Ubuntu 14.04 Server LTS

Note: In case you have an regular(3.0.5-1) version of GlusterFS to upgrade, it is recommended to run the following command in order to make sure the older version gets cleaned-up does not interfere with the new one. apt-get purge glusterfs-client glusterfs-server Depending on whether you have Debian or Ubuntu use one of the following installations: …

Linux, Wordpress

Install a multisite(WPMU) WordPress with wp_cli

Prerequisites: – Create a new fcgi driven user in Linux system(in this case usrblog) useradd -s /bin/bash -d /www/clients/mywpsite.com/htdocs/ usrblog passwd usrblog – Install a Virtual host which uses suexec and fcgi in Apache/NginX – Create a new database in MySQL (we will call it myblog) – Create a new mysql user and assign the …

Linux, MySQL

PAM-Mysql user authentication in Ubuntu 14.04 LTS Server

Introduction: As I was wanting to set-up a cluster of web servers based on Apache2 and fcgi I realized that I didn’t want to have to create/delete/update each individual fcgi user in each web server. Therefore I decided to authenticate the fcgi users through MySQL (in fact MariaDB). I’ve done that many years back but …

Bash, Linux, Security

Encrypt a password with different encryption methods

Situation: I happen to have configured a Linux system with MySQL database and wanted to enter a password in the password field in the DB. Here is a way I found. This will output in the terminal the encrypted string you can then enter directly in the password field via phpmyadmin or mysql client. Note: …

Linux

Usefull commands of LVM

Just to make sure I don#t forget where to find such useful set of commands for the LVM I copied it here integrally from: https://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/LV_create.html 4.4.1. Creating Logical Volumes To create a logical volume, use the lvcreate command. You can create linear volumes, striped volumes, and mirrored volumes, as described in the following subsections. If …

Apache, Linux

Selectively blocking / redirecting HTTP requests per country of origin with Apache

If you need to block or redirect requests that are originated from certain countries, here is a good method using geoIP information. Install the GeoIP binaries and Apache module: apt-get install geoip-bin libgeoip1 libapache2-mod-geoip a2enmod geoip service apache2 restart Example of blocking requests from germby(DE) in a VirtualHost configuration: SetEnvIf GEOIP_COUNTRY_CODE DE BlockCountry Deny from …

Apache, Linux

phpmyadmin: The mcrypt extension is missing. Please check your PHP configuration.

This was the error message I got in PhpMyadmin in Ubuntu 14.04-2. The mcrypt extension is missing. Please check your PHP configuration. So I found the following solution in: http://askubuntu.com/questions/460837/mcrypt-extension-is-missing-in-14-04-server-for-mysql/477608#477608 First, I’m not really sure that this directory needs to be created, but since it’s in php.ini configuration, I’d rather make sure all will work …

Linux, Postfix

Relay emails for specific destinations

In the last couple of years many large email providers have started to refuse emails coming from certain IP addresses or according to certain other criteria. It is difficult to know for what reason certain emails are refused access with the server answer: ….refused to talk to me: 554…. The list of these emails destinations(which …

Linux

Proxy Internet access via SSH tunnels and and tsocks

Description: I came across a situation where I needed to install software on a server that didn’t have internet access, except for the apt-get commands which are only reaching specific Internet addresses (allowed by the firewall). So in our network there is a Linux server that does have full Internet access. The idea here is …

Linux, NGinX, NGinX

Installing NginX 1.9.2 in Ubuntu server 14.04.2 LTS

Since the version of NginX in Ubuntu Server 14.04.2 is only 1.4.6, we need to tell APT to install the more recent version of nginx directly from the NginX maintainer. Steps: Add the following lines in /etc/apt/sources.lst deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx From your server download the signing key add it to …

Linux

Adding IPs to a network Interface in Linux

Sometimes we need to add extra IPs to a network interface to handle HTTPS requested by mechanisms that don’t support SNI. There are many ways to do that but here are the one I prefer. Extra IP belonging to a different subnet In order to be able to add an extra IP belonging to another …

Linux, Monitoring

Install TeamViewer in Debian Wheezy

Teamviewer is a very good and stable remote desktop with many clients software form almost any platform. Here I explain how I got TeamViewer to run on a headless Debian Wheezy server. Reference: https://www.teamviewer.com/en/help/363-Wie-installiere-ich-TeamViewer-auf-meiner-Linux-Distribution.aspx#multiarch Steps: – Install the VNC desktop on the Debian Server for a particular user as per the instructions shown here: https://tipstricks.itmatrix.eu/installing-linux-remote-terminal-using-vnc-on-a-debian-server/ …

Bash, Linux

Downloading tar.gz files from the Linux command line

Sometimes we need to download a file from Internet using the bash command line. here are some suggestions: Using WGET: wget {URL} eg. wget https://my.server.com/downloads/file.tar.gz Using CURL: (Fancy progress info given as the download progresses and will unpack it at the same time) curl -L –progress {URL} | tar xz eg. curl -L –progress https://my.server.com/downloads/file.tar.gz …