Thursday, March 29, 2012

Increase the Swap space in Linux

Add a Swap Partition:

you need to create a new partition of desired size in the file have created a partition say /dev/sda7 having size 1GB.

[root@den ]# mkswap /dev/sda7 Setting up swapspace version 1, size = 1057092 KiB no label, UUID=5ad400b1-3a7f-449c-9605-c257e56ba381  
[root@den ]# free
total used free shared buffers cached
Mem: 3040320 467800 2572520 0 28032 255368
-/+ buffers/cache: 184400 2855920
Swap: 4289312 0 4289312

The free command above shows around 4GB of swap space. Now lets activate the swap partition.
[root@den ]# swapon /dev/sda7 
[root@den ]# free
total used free shared buffers cached
Mem: 3040320 659016 2381304 0 29296 328196
-/+ buffers/cache: 301524 2738796
Swap: 5346400 0 5346400

Notice that the free memory space rose to around 5GB
To make the changes permanent you can put an entry in the /etc/fstab file as

/dev/sda7 swap swap defaults 0 0
Add a Swap File: 
[root@den ]# dd if=/dev/zero of=/swap_file bs=1024 count=524288
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 3.79122 s, 142 MB/s
[root@den ]# mkswap /swap_file
mkswap: /swap_file: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=8d200179-e61b-4f04-8aff-8140d667781
[root@den ]# swapon /swap_file

To enable it at boot time, add an entry like the below line in the /etc/fstab file.

/swap_file swap swap defaults 0 0

To verify that the swap has been enabled or not you can use the free command as discussed above or also you can see the contents of the file

cat /proc/swaps

Vishal Vyas

How to install Php,Mysql and Lighttpd on Ubuntu

Install Lighttpd, PHP and MySQL on Ubuntu

Sometimes you don’t want Apache for your web server whatever your reasons might be. There are other options like Nginx and Lighttpd, today I’ll setup Lighttpd along with PHP (via FastCGI) and MySQL.

Assuming you have a clean Ubuntu 10.10 system running go into the terminal and issue the following commands to install aptitude and Lighttpd:
$ sudo apt-get update
$ sudo apt-get install aptitude
$ sudo aptitude install lighttpd

Verify that Lighttpd is running: http://localhost/ You should see a default placeholder webpage.

Installing MySQL:
$ sudo aptitude install mysql-server mysql-client

Note: During the MySQL installation you will be prompted to set the root password.
Installing PHP (and some commonly used libraries – modify as needed):
$ sudo aptitude install php5-cgi php5-dev php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ps php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-xsl php5-common php5-mysql

In order to get Lighttpd and PHP working together you need to modify this file: /etc/php5/cgi/php.ini
$ sudo pico /etc/php5/cgi/php.ini

Inside the file look for the following line:

Change it to this:
Save and exit the file.

Finally here are the last few commands to enable the PHP configuration and FastCGI module as well as reloading the Lighttpd web server:
$ sudo lighty-enable-mod fastcgi
$ sudo lighty-enable-mod fastcgi-php
$ sudo service lighttpd force-reload

We can test out PHP with a simple script (see below). However, there are a few things to note first:
1. The Lighttpd default document root (On Ubuntu 10.10) is located at: /var/www
2. The lighttpd.conf file (On Ubuntu 10.10) is located at: /etc/lighttpd/lighttpd.conf

Create a new file called info.php in the /var/www folder:
sudo pico /var/www/info.php

Add this code to the new file and then save and exit.

Browse to http://localhost/info.php to examine all the PHP info.


Monday, March 19, 2012

Install ntop on RedHat Or CentOs 5


Download the rpmforge-release package. Choose one of the two links below, selecting to match your host's architecture. If you are unsure of which one to use you can check your architecture with the command uname -i

The preferred rpmforge-release package to retrieve and to install in order to enable that repository is one of the two listed above.

Install DAG's GPG key

rpm --import

Verify the package you have downloaded

rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm

Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the md5sum of the key injection package, and trust Dag, et al., then it should be as safe as your trust of them extends.

Install the package

rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm

Installing Ntop :
There is an ntop rpm in the rpmforge repository:
yum install ntop

There is a bug in the /etc/init.d/ntop startscript we need to fix. Open the file in your favorite editor for example vim:
vim /etc/init.d/ntop

change the line at start function from:
daemon $prog -d -L @/etc/ntop.conf
daemon $prog @/etc/ntop.conf -d -L

first time you start ntop you need to set the admin password:
ntop @/etc/ntop.conf

you should now be able to start ntop deamon via:
service ntop start

if you want to start ntop at boot:
chkconfig --levels 35 ntop on

webinterface is running on http port 3000 and https on port 3001:

Vishal Vyas

How to Install docker-compose CentOS7

 Install Docker-compose on CentOs7 Linux. yum install -y epel-release yum install -y python-pip pip install --upgrade pip pip install ...