Category: Linux

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

Linux, SVN

Undeleting a directory from SVN repository

Situation: A directory had been deleted a while ago from the repository and we want it back without interfering with commits that were since made in other parts of the repository, and without having to have the repository in the workspace. Reference: http://svnbook.red-bean.com/en/1.8/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo Solution: – Find out which revision of the commit it was that …

GIT, Linux

Installing GitLab (MySQL based) on Ubuntu 14.04.2 LTS Server

Note: Instructions based on but have been modified in a few places to make it work with mySQL: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md and https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md Extra related Info: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md https://www.linode.com/docs/applications/development/gitlab-on-ubuntu-14-04 and https://www.digitalocean.com/community/tutorials/how-to-set-up-gitlab-as-your-very-own-private-github-clone#database-setup STEPS adduser –disabled-login –gecos ‘GitLab’ git apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils …

Linux, Windows

Can’t connect to VSFTPD with Filezilla

Problem: Because of some incompatibility of the default use of cyphers in VSFTPD FileZilla cannot connect to it. Solution: Edit the VSFTPD configuration file /etc/vsftpd.conf and add the following directive: ssl_ciphers=HIGH Restart VSFTPD server and use the default settings for new FTP connection with incryption of ‘explicit FTP over TLS’.

Bash, Linux, VMWare, XEN

Extending dynamically Linux RAMs in VMWare VM without rebooting

Situation: Need to raise the amount of RAM in a VMWare VM without rebooting. Solution: – In VMWare interface: Raise the amount of RAM for the VM – In the Linux VM: Run the following script: #!/bin/bash # This script enables in system the unrecognized RAMs deleteline () { echo -ne $dellineup } ### check …

Linux, VMWare, XEN

Update the number of CPU dynamically in a VMWare VM

Situation: I’ve come across a situation where I needed to LIVE-raise the number of CPUs for a VMWAre Linux VM without having to reboot. Solution: – In VMAre ris the number of CPUs – In the Linux VM do the following: – Save the following script into /root/bin/ directory (It was take from this article: …

Linux, Postfix

Installing DMARC filtering in Debian Wheezy

Principle: DMARC is a bit of a strange animal. It serves as a filter against SPAM but only according to the rules given by the owner of the domain sending emails. So, for example, if I send emails as sender me@example.com using a mail client program via my mail server , in order that my …

Bash, Linux

Copying all files including hidden files in Linux command

PROBLEM: If you use the command cp or mv on hidden files you will notice that the hidden files won’t get ‘seen’ and therefore not copied or moved. The problem doesn’t belong to cp or mv but to bash. Bash doesn’t include the hidden files in the globbing expansion. for example: mkdir ~/temp1 ~/temp2 touch …

Linux, Postfix

Anti-SPAM mail filtering using SPF on Debian Wheezy

Install the package: apt-get install postfix-policyd-spf-perl Add this line to /etc/postfix/main.cf: policy-spf_time_limit = 3600s Add the following lines to /etc/postfix/master.cf: policy-spf unix – n n – – spawn user=policyd-spf argv=/usr/sbin/postfix-policyd-spf-perl In /etc/postfix/main.cf, find the smtpd_recipient_restrictions section, and, immediately after permit_mynetworks (and permit_sasl_authenticated, if you’re using that), add: check_policy_service unix:private/policy-spf, Restart Postfix and check your logs …

Linux, NGinX, NGinX, Postfix

TCP Load balancing email/web servers with NginX

I’ve got 2 synchronized email servers running and, in order to make sure I don’t have to change the servername settings of my mail client in case one server goes down, I was looking for a straight TCP layer load balancer. There are a few software packages on the market that can do that , …

Apache, Linux, Monitoring, NGinX

Using CURL for sending crafted HTTP POST authenticated queries

CHALLENGE: I came across a situation where I needed to send an HTTP request using the POST method with some POST data but after I have authenticated with name and password. SOLUTION:(using curl tool) The trick here is to preserve the SESSIONID of the authenticated response for the second POST request. EXAMPLE: I needed to …

Linux, Linux on MACBook, MAC OS X

How to create a USB stick bootable on OS X

This article is based on the following How-to in Ubuntu site: http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx We would encourage Mac users to download Ubuntu Desktop Edition by burning a CD. But if you prefer to use a USB stick, please follow the instructions below. Note: this procedure requires that you create an .img file from the .iso file you …

Linux, VMWare

Hard disk resize and sync without rebooting

Description: Sometimes I need to resize a virtual disk for a virtual machine without having to reboot the machine. For the kernel to recognize that a virtual disk has changed size. Here are the step to do that: Unmount the concerned partition: Eg. /dev/sdb1 umount /dev/sdb1 Find out which SCSI devices are involved: ls /sys/class/scsi_device/ …

Linux, XEN

Installing Xen 4.4 on Ubuntu Server 14.04 LTS (Trusty) in a Hetzner server with 8 IPs subnet

Hetzner Germany has very fast and not expensive rentals of Hardware servers available. In order to communicate internally via private network between Xen-DOMUs and DOM0, normally one would install Xen DOM0 network with bridge networking as follows: DOM0:xenbr0(eth0) ===bridging===>> DOMUs:eth0 BUT!!!! PROBLEM: Because of the configuration of the network switches at Hetzner, one hardware server …

Linux, MAC OS X

Resuming files copy after break with rsync

In my work, I often need to transfer large files from my MAC desktop to a Linux server in Internet. Since the Internet connection is often broken and changes IP, transferring of large files really can be difficult. That is where rsync come to the rescue by saving the already transferred part of the file …

Apache, Bash, Linux, Monitoring, NGinX

Monitoring latency time of http requests

Here is a simple but useful command which shows the latency time of http requests. You can adjust the delay between repeats as well as the URL being queried. Reference: http://www.shellhacks.com/en/Check-a-Website-Response-Time-from-the-Linux-Command-Line host=”www.google.de”; delay=5; while true ; do echo -n “Response time for http://$host:” ;curl -s -w %{time_total}\\n -o /dev/null http://$host ;sleep $delay; done Results: Response …

Linux

Wandisco SVN(Subversion) installation on Debian Wheezy

To my experience, compiling the latest Subversion from Collab site is quite some work. As an alternative to this, Wandisco site offers for free the (almost)-newest version of subversion package for Debian. It’s already compiled, tested and ready for production. Since Debian Wheezy doesn’t quite have the proper versions of packages necessary to install these …

Bash, Linux

Resolve the IP from a hostname

As a Linux administrator I often need to resolve hostnames into IPs specially in scripts. Using the command ‘host’ the sytem will resolve the IP only through the resolver libraries omitting to look into the /etc/hosts file. The same is true for the command ‘nslookup’ and ‘dig’. A good trick is to use the command …

Linux

Changing the keyboard layout of Terminal in Ubuntu

Even if you install Ubuntu with the proper keyboard, it could happen that the terminal application is still set to EN-USA Layout. To change the keyboard at the terminal level, login as root and issue this command from in the terminal: dpkg-reconfigure keyboard-configuration Then reboot Linux.

Linux

Install Adaptec ACC-RAID utility – arcconf – in Ubuntu 14.04

In order to be able to control the Apaptec AACRAID Raid controller in Ubuntu one need to install the program arcconf from third party as follows: Ref: https://www.thomas-krenn.com/de/wiki/Adaptec_arcconf_unter_Ubuntu_installieren wget -O – http://archive.thomas-krenn.com/tk-archive.gpg.pub | sudo apt-key add – cd /etc/apt/sources.list.d wget http://archive.thomas-krenn.com/tk-main.list wget http://archive.thomas-krenn.com/tk-optional.list apt-get update apt-get install arcconf Getting info on the installed RAID controller: …