blog.up-link.ro android bsd linux unix & open-source world

31May/100

How to speed up the boot time in Ubuntu by profiling the boot process

There is way to improve the speed of boot process in Ubuntu Linux by profiling your boot. Profiling lets Ubuntu make a list of all the files that are accessed during bootup, it then sorts the files according to how they are stored on your hard-disk. So the next time the system is booted, the files would be read faster.

To profile boot you need to follow these steps:

  • At the grub menu highlight the kernel
  • Press e for edit
  • Choose the line starting with kernel and press e again. Now add the word profile to the end of this line. Hit Enter and then press b to boot

NOTE: The system will boot slower this one time, the next time however you should see an improvement. Also keep in mind that all this is machine-dependent and also depends on the arrangement of files on your hard-disk, so the difference you see might not be huge, or even nil in some cases.

Print This Post Print This Post
31May/100

Linux Tips: Keyboard shortcuts and command line tricks

In this article I will show you some keyboard shortcuts and other command line tricks to make entering commands easier and faster. Learning them can make your life a lot easier!

Here are some keyboard shortcuts you can use within terminal:

Alt-r              Undo all changes to the line.
Alt-Ctrl-e        Expand command line.
Alt-p              Non-incremental reverse search of history.
Alt-] x            Moves the cursor forward to the next occurrence of x.
Alt-Ctrl-] x      Moves the cursor backwards to the previous occurrence of x.
Ctrl-a             Move to the start of the line.
Ctrl-e             Move to the end of the line.
Ctrl-u             Delete from the cursor to the beginning of the line.
Ctrl-k             Delete from the cursor to the end of the line.
Ctrl-w            Delete from the cursor to the start of the word.
Ctrl-y             Pastes text from the clipboard.
Ctrl-l              Clear the screen leaving the current line at the top of the screen.
Ctrl-x Ctrl-u    Undo the last changes. Ctrl-_
Ctrl-r              Incremental reverse search of history.
!!                   Execute last command in history
!abc               Execute last command in history beginning with abc
!n                  Execute nth command in history
^abc^xyz       Replace first occurrence of abc with xyz in last command and execute it

Print This Post Print This Post
26May/100

How To Install and Configure ddclient in FreeBSD and Linux to work with OpenDNS

ddclient is an open-source dynamic IP update client written in Perl. ddclient is available here.

This article shows how to install and configure ddclient in FreeBSD and Linux so it will update your OpenDNS account with your dynamic IP from your ISP.

1. Installation

For CentOS / Fedora, install ddclient via yum:

yum install ddclient

For Debian and Ubuntu, install ddclient via apt-get:

apt-get install ddclient

For FreeBSD, install ddclient from the FreeBSD ports collection:

cd /usr/ports/dns/ddclient
make install clean

2. Configuration

After installing ddclient, you have to create / edit ddclient.conf ( for FreeBSD the configuration should be located in /usr/local/etc, for CentOS should be located in /etc/ddclient and for Debian or Ubuntu in /etc ) as follows:

Print This Post Print This Post
24May/100

How To change MTU size under FreeBSD and Linux

The maximum transmission unit (MTU) of a layer of a communications protocol is the size (in bytes) of the largest protocol data unit that the layer can pass onwards.

1. Changing the MTU size with ifconfig tool

In order to change the MTU size, use ifconfig as follows:

ifconfig [Interface] mtu [SIZE] up
ifconfig eth0 mtu 1500 up

NOTE: This will only work if supported by both the network interface card and the network components such as switch.

Print This Post Print This Post
23May/100

How To Update all CentOS/RHEL servers remotely using a shell script

#!/bin/bash
#
# A simply shell script to update remote CentOS/RHEL servers
# You must have ssh public and private key installed. This will save a lot of time if you
# have many servers.
#
# by Adi http://blog.up-link.ro
# May 2010

# an array to store ssh commands for each server
hosts=(
        "ssh root@192.168.1.1 yum update -y"
        "ssh root@192.168.2.1 -p 2222 yum update -y"
        "ssh adi@192.168.3.1 -t sudo  '/usr/bin/yum update -y'"
      )
# read the array and launch the ssh command
for sshcmd in "${hosts[@]}";do $sshcmd;done
Print This Post Print This Post
22May/1012

How To Install OpenVPN in FreeBSD

OpenVPN is a an open source software application that implements virtual private network (VPN) solutions for creating secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. OpenVPN uses SSL/TLS security for encryption and is capable of traversing network address translators and firewalls.

I. OpenVPN Server - Installation and Configuration

1. Installing OpenVPN Server

To install OpenVPN from FreeBSD ports, enter:

cd /usr/ports/security/openvpn
make install clean

OpenVPN Installation Screenshot 1

Print This Post Print This Post
21May/100

How To Update CentOS Linux 5.4 to CentOS 5.5

CentOS ( Community ENTerprise Operating System ) is a community-supported, mainly free software operating system based on Red Hat Enterprise Linux. It exists to provide a free enterprise class computing platform and strives to maintain 100% binary compatibility with its upstream distribution.

CentOS 5.5 has been released and available via mirrors for immediate update. For more information about this release you can read the release note.

If you have CentOS 5.4 already installed, before to do anything first back up anything you care about.

Print This Post Print This Post
17May/101

How To Install Lighttpd with PHP5 and MySQL support on CentOS 5

Lighttpd is an open-source web server optimized for speed-critical environments. It's standards-compliant, secure and flexible. In this tutorial I'll show you how to install Lighttpd on a CentOS 5.4 server with PHP5 support (through FastCGI) and MySQL support.

1. Installing MySQL 5 Server

To install MySQL run this command from the shell:

# yum install mysql mysql-server

Enable MySQL server on boot and start MySQL server:

# chkconfig --levels 235 mysqld on
# service mysqld start

Print This Post Print This Post
13May/100

UNIX Tools: fdupes – Get rid of duplicate files

fdupes is a  tool for identifying or deleting duplicate files residing within specified directories. It first compares file sizes and MD5 signatures, and then performs a byte-by-byte check for verification.

1. Install fdupes

Type the following commands to install fdupes in FreeBSD:

# cd /usr/ports/sysutils/fdupes
# make install clean

Type the following command to install fdupes in CentOS / Fedora / RHEL (make sure you have rpmforge repo enabled):

Print This Post Print This Post
7May/100

Linux Security: Access Rights and Permissions for Files and Directories

1. Introduction

The Linux security model is based on the one used on UNIX operating systems. On a Linux system, every file is owned by a user and a group user. There is also a third category of users, those that are not the user owner and don't belong to the group owning the file.  For each category of users, read, write and execute permissions can be granted or denied.

The file permissions for these three user categories are indicated by the nine characters that follow the first character, which is the file type indicator at the beginning of the file properties line. The first three characters in this series of nine display access rights for the actual user that owns the file. The next three are for the group owner of the file, the last three for other users.

The permissions are always in the same order: read, write, execute for the user, the group and the others.

Print This Post Print This Post