Author: admin

MAC OS X

How to upgrade your Mac from a rotary(regular) hard disk to an SSD.

Introduction: Very often friends that have a Mac or PC tell me that they need to buy a new Mac/PC because the present one has become too slow. Generally these machines have no internal SSD installed as system hard disk. In this case I often recommend to install an SSD instead of buying a new …

Linux, MySQL

Resetting MySQL passwords in Linux Debian/Ubuntu

In Linux Debian/Ubuntu an extra user debian-sys-maint which also has all the access rights is used for maintenance. It can also be used to reset users passwords especially the root password when lost. Here are some tips regarding resetting them. Resetting the ‘root’ passwordmysqladmin -u root -p password “MyNewPass”ORmysql -u debian-sys-maint -p update mysql.user set …

Apache, Linux, Security

Limiting the number of connected clients on a VirtualHost in Apache

Problem: When a DDOS attack or a burst of requests are coming at the same time in my Apache2 Web server, the whole server can run out of RAM and crash. Possible solution: Limit the number of simultaneous connections to your Web server per VirtualHost Method: One simple and effective method done directly on the …

Apache, Linux

Using mod_cluster in Apache

The newly discovered Apache module mod_cluster seems to offer many advantages compared to mod_jk which could be used in the new Apache/Jboss environment. The following features are listed: – Dynamic configuration of httpd workers – Server-side load balance factor calculation – Fine grained web-app lifecycle control – AJP is optional – Compatible staring at JBoss …

Apache, Linux

Configuring Apache to handle WebSocks

WebSocks is supported by Apache starting at version 2.4.xx. Here are some minimal configuration for Apache 2.4.xx. in Ubuntu 14.04.x Install the proper modules: a2enmod proxy a2enmod proxy_wstunnel Configure the VirtualHost (only the WebSock part is shown here) # Make sure the backend server gets the right URL in ‘Location:’ http Header ProxyPreserveHost On # …

Linux

Install Java7 Runtime Engine in Debian Squeeze

Introduction: Debian Squeeze has only Java6 available. So here is one method to install Java7 on Debian Squeeze. Method 1: TARBAL. Steps cd /usr/src wget –no-cookies –no-check-certificate –header “Cookie: oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/7u72-b14/jre-7u72-linux-x64.tar.gz” tar -xvzf jre-7u72-linux-x64.tar.gz mkdir /usr/lib/jvm mv /usr/src/jre1.7.0_72 /usr/lib/jvm/ ln -s /usr/lib/jvm/jre1.7.0_72/ /usr/lib/jvm/java-7-oracle cd /etc/alternatives mv java java.6 ln -s /usr/lib/jvm/java-7-oracle/bin/java java java -version

Linux, Security

Verifying the integrity of files with md5sum

In order to transfer files and be sure that they were not compromised on their way to their destinations a method of ‘checksumming’ the file’s content can help. Under Linux the tool is called ‘md5sum’. Here is how to use it. For example to check the integrity of the downloaded Ubuntu Linux .iso file. md5sum …

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 …