PPTP VPN Server on Debian/Ubuntu

PPTP VPN Server on Debian/Ubuntu

Quick setup: Copy and Paste

This section is for the impatient. All you have to do is login to your Debian/Ubuntu server and copy paste the following commands and you’ll have a working VPN server in less than 2 mins.
In this section I assume you’re logged in as the root user, do NOT have any instance of pptpd installed now or earlier and the “net.ipv4.ip_forward” is commented in the /etc/sysctl.conf file.

apt-get install pptpd -y
update-rc.d pptpd defaults
echo "localip 192.168.1.1" >>; /etc/pptpd.conf
echo "remoteip 192.168.1.2-254" >> /etc/pptpd.conf
echo "ms-dns 8.8.8.8" >> /etc/ppp/pptpd-options
echo "ms-dns 8.8.4.4" >> /etc/ppp/pptpd-options
echo "username * Pa55w0rd *" >> /etc/ppp/chap-secrets
service pptpd restart
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p
iptables -I INPUT -p tcp --dport 1723 -m state --state NEW -j ACCEPT
iptables -I INPUT -p gre -j ACCEPT
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -s 192.168.1.0/24 -j TCPMSS  --clamp-mss-to-pmtu

Install the PPTPD package

On Debian/Ubuntu operating systems
apt-get install pptpd -y
update-rc.d pptpd defaults

Setup VPN and DNS IP addresses

 Edit the following file
nano /etc/pptpd.conf
And add the following lines to the end
localip 192.168.1.1
remoteip 192.168.1.2-254
You can use any private IP address range just make sure it is not already used in your local network and the local IP and the remote IP are in the same range.
Edit the following file to mention DNS servers
nano /etc/ppp/pptpd-options
Add the following lines to the end
ms-dns 8.8.8.8
ms-dns 8.8.4.4
You can use any DNS server here I’m using Google Public DNS just as an example.

Add usernames and passwords

Edit the following file
nano /etc/ppp/chap-secrets
and add username/password combinations one in each line in the following format

username * password *

Example

kirthan * rsEsss *
user2 * vPnpass *

If only you are going to use this VPN server a single username/password combination is enough.

Restart the pptpd service

service pptpd restart

Enable forwarding and create iptables rules

Our main purpose of setting up this VPN server is to access website right ? So our traffic has to be forwarded out of the VPN server’s public network interface.
Enable port forwarding on Linux by editing the sysctl.conf file

nano /etc/sysctl.conf

Add or find and comment out the following line





net.ipv4.ip_forward=1

Save, close the file and run the following command to make the changes take effect.

sysctl -p

The following iptables firewall rules allow port 1723, GRE and perform NAT


iptables -I INPUT -p tcp --dport 1723 -m state --state NEW -j ACCEPT
iptables -I INPUT -p gre -j ACCEPT
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
In the last rule replace “eth0″ with the interface connecting to the internet on your VPN server. Finally the following rule is required to ensure websites load properly
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -s 192.168.1.0/24 -j TCPMSS  --clamp-mss-to-pmtu
Replace 192.168.1.0/24 with the IP address range used in the “remoteip” option in the /etc/pptpd.conf this firewall rule is used to ensure a proper MTU value is used to prevent fragmentation. To save the IPTables rules 

Create a VPN connection on your computer

Open the network setting and create new vpn connection
and add the Vpn server detail like password username ip




Free OpenVPN and PPTP VPN

Click on this link : Free vpn server


 

SSL Authentication for website

Two Way SSL Authentication

In standard SSL connections your browser verifies the identity of the server via it's certificate. With 2 way authentication your browser also needs a certificate in order for the server to verify it and allow it access to the pages.

  Steps reqired :

  1. Creating OpenSSL certificates
  2.  Configure Apache 
  3.  Configure your browser

Creating OpenSSL certificates

Make sure OpenSSL is installed on whichever server you want to be your CA.
You will need an openssl.cnf file. Here is the one I used.
 
#/etc/ssl/openssl.cnf

[ req ]
default_md = sha512
distinguished_name = req_distinguished_name

[ req_distinguished_name ]
countryName = Country
countryName_default = GB
countryName_min = 2
countryName_max = 2
localityName = Locality
localityName_default = United Kingdom
organizationName = Organization
organizationName_default = SpiderWiki
commonName = Common Name
commonName_max = 64

[ certauth ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always
basicConstraints = CA:true
crlDistributionPoints = @crl

[ server ]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
nsCertType = server
crlDistributionPoints = @crl

[ client ]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment, dataEncipherment
extendedKeyUsage = clientAuth
nsCertType = client
crlDistributionPoints = @crl

[ crl ]
URI=http://www.spiderwiki.org/ca.crl

So first we need a self signed certificate for our CA.
 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
openssl req -config /etc/ssl/openssl.cnf -newkey rsa:2048 -nodes -keyform PEM -keyout ca.key -x509 -days 3650 -extensions certauth -outform PEM -out ca.cer
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Next we will generate a private SSL key for our server.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
openssl genrsa -out server.key 2048
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To generate Certificate Signing Request (PKCS#10) run the following command. For the common name you should put the URL for the server e.g. www.spiderwiki.org
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
openssl req -config  /etc/ssl/openssl.cnf -new -key server.key -out server.req
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
With self-signed certificate authority issue server certificate with serial number 100:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
openssl x509 -req -in server.req -CA ca.cer -CAkey ca.key -set_serial 100 -extfile /etc/ssl/openssl.cnf -extensions server -days 365 -outform PEM -out server.cer
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The new file contains both the certificate and the private key so we can delete the request file.
 
rm server.req

Now that the server certificates are done we need to create the key for a client.
 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
openssl genrsa -out client.key 2048

Then the request.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 openssl req -config /etc/ssl/openssl.cnf -new -key client.key -out client.req
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

And issue certificate ID with our CA for the client.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
openssl x509 -req -in client.req -CA ca.cer -CAkey ca.key -set_serial 101 -extfile /etc/ssl/openssl.cnf -extensions client -days 365 -outform PEM -out client.cer
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Save client's private key and certificate in a PKCS#12 format. You will need to set a password in this command.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
openssl pkcs12 -export -inkey client.key -in client.cer -out client.p12
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
Then tidy up.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
rm client.key client.cer client.req
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Configure Apache

Depending on the version of Apache and your distro this can be slightly different so as a general guide.
  • You need to tell Apache to also listen on port 443 (at least that's the default for SSL)
  • You need to enable the SSL module.
  • Set a new VirtualHost (or modify your main server to use SSL)
  • Move the required files to the location set in your virtual host.
  • Restart Apache
Here is my default-ssl virtual host config file.
 
#vi /etc/apache2/sites-available/default-ssl 
 
<IfModule mod_ssl.c>
<VirtualHost _default_:443>

        ServerAdmin webmaster@localhost

        DocumentRoot /var/securewww/
        
                Options FollowSymLinks
        
                Options Indexes FollowSymLinks MultiViews
        

        LogLevel warn
        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/ssl_access.log combined

        SSLEngine on
        SSLCertificateFile    /etc/apache2/ssl/server.cer
        SSLCertificateKeyFile /etc/apache2/ssl/server.key
         
        # Below for 2 way ssl
        SSLVerifyClient require
        SSLVerifyDepth 10
        SSLCACertificateFile /etc/apache2/ssl/ca.cer



</VirtualHost>
</IfModule>

Configure your browser

Copy client.p12 file to the machine you intend to use. Install it into your browsers certificate store. This process is different on each browser.

htaccess ip restriction

Create .htaccess file inside your site folder and copy the below content to .htaccess file and replace "your_site_folder" to your's and also the IP

----------------------------------------------------------------------------------------------------------------------------------------
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/vhosts/your_site_folder/.htpasswd   
#path to htpasswd   
AuthGroupFile /dev/null


Satisfy Any
<Limit GET POST>
    Order Deny,Allow
    Deny from all
    Allow from 192.168.0.5              #(ip needed to be allowed)

    Allow from 192.168.0.6              #(ip needed to be allowed)
    Allow from 192.168.0.7              #(ip needed to be allowed)
    Require valid-user
</Limit>

----------------------------------------------------------------------------------------------------------------------------------------

OR                                                        


The htpassd file can also be added in /etc/apache2/site-available ceare a file in this folder and add the below line to that folder. And below is that if you are using proxy.

<VirtualHost *:80>
      ServerName kir.example.com

    ProxyRequests off

ProxyRequests off

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    <Location />
        AuthType Basic
        AuthName "Please Log in"
        AuthUserFile /var/www/myapp/.htpasswd            #path to htpasswd file
        Require valid-user
        Order allow,deny
        Allow from 000.00.00.00
        Allow from 000.00.00.00

        Allow from 000.00.00.00
        satisfy any
        ProxyPass http://localhost:3500/
        ProxyPassReverse http://kir.example.com:3500/
    </Location>

</VirtualHost>

 

Add a User To Group Linux

Add a existing user to existing group :

To add an existing user jerry to sftpjail supplementary/secondary group with usermod command using -a option ~ i.e. add the user to the supplemental group(s). Use only with -G option:
-----------------------------------------------------------------------------------------------------------------------------
usermod -a -G sftpjail jerry
-----------------------------------------------------------------------------------------  
 
To change existing jerry's primary group to lll, enter:

-----------------------------------------------------------------------------------------
usermod -g lll jerry 
-----------------------------------------------------------------------------------------

Errr 'mongo.js:L112 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112'

If you are running Ubuntu, then there is an issue with folder ownership. 

Run these commands:
  1. Stop the MongoDB service
    -------------------------------------------------------------------------------------------------------------------------------
    sudo service mongodb stop
    -------------------------------------------------------------------------------------------
  2. Remove the MongoDB lock file
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo rm /var/lib/mongodb/mongod.lock
    --------------------------------------------------------------------------------------------
  3. Change ownership from root to the MongoDB path
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo chown -R mongodb:mongodb /var/lib/mongodb/
    ---------------------------------------------------------------------------------------------
  4. Start the MongoDB service
    ------------------------------------------------------------------------------------------------------------------------------- 
    sudo service mongodb start
    ----------------------------------------------------------------------------------------------
  5. Test the mongo application
    ------------------------------------------------------------------------------------------------------------------------------- 
    mongo 
    ---------------------------------------------------------------------------------------------

Backup (mysql dump) all your MySQL databases in separate files

The below is the bash script to take mysql dump seperately

-----------------------------------------------------------------------------------------------------------------------------------------
#! /bin/bash

TIMESTAMP=$(date +"%F")
BACKUP_DIR="/backup/$TIMESTAMP"
MYSQL_USER="backup"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="password"
MYSQLDUMP=/usr/bin/mysqldump

mkdir -p $BACKUP_DIR

databases=`$MYSQL --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema)"`

for db in $databases; do
  $MYSQLDUMP --force --opt --user=$MYSQL_USER -p$MYSQL_PASSWORD --databases $db | gzip > "$BACKUP_DIR/mysql/$db.gz"
done
-----------------------------------------------------------------------------------------------------------------------------------------

HOW TO CREATE SSL SELF SIGNED CERTIFICATE ( UBUNTU )

About SSL Certificates

A SSL certificate is a way to encrypt a site's information and create a more secure connection. Additionally, the certificate can show the virtual private server's identification information to site visitors. Certificate Authorities can issue SSL certificates that verify the server's details while a self-signed certificate has no 3rd party corroboration.

Set Up

Additionally, you need to have apache already installed and running on your virtual server.
If this is not the case, you can download it with this command:
sudo apt-get install apache2

Step One—Activate the SSL Module


The next step is to enable SSL on the droplet.
sudo a2enmod ssl

Follow up by restarting Apache.
sudo service apache2 restart

Step Two—Create a New Directory


We need to create a new directory where we will store the server key and certificate
sudo mkdir /etc/apache2/ssl 

Step Three—Create a Self Signed SSL Certificate


When we request a new certificate, we can specify how long the certificate should remain valid by changing the 365 to the number of days we prefer. As it stands this certificate will expire after one year.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

With this command, we will be both creating the self-signed SSL certificate and the server key that protects it, and placing both of them into the new directory.

This command will prompt terminal to display a lists of fields that need to be filled in.

The most important line is "Common Name". Enter your official domain name here or, if you don't have one yet, your site's IP address.
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:NYC
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Awesome Inc
Organizational Unit Name (eg, section) []:Dept of Merriment
Common Name (e.g. server FQDN or YOUR name) []:example.com                  
Email Address []:webmaster@awesomeinc.com

Step Four—Set Up the Certificate


Now we have all of the required components of the finished certificate.The next thing to do is to set up the virtual hosts to display the new certificate.

Open up the SSL config file:
sudo nano /etc/apache2/sites-available/default

You should make the following changes.

Change the port on the virtual host to 443, the default SSL port:
<VirtualHost *:443>
Add a line with your server name right below the Server Admin email:
ServerName example.com:443

Replace example.com with your DNS approved domain name or server IP address (it should be the same as the common name on the certificate).

Add in the following three lines to the end of your virtual host configuration, and make sure that they match the extensions below:
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
Save and Exit out of the file.

Step Five—Activate the New Virtual Host


Before the website that will come on the 443 port can be activated, we need to enable that Virtual Host:
sudo a2ensite default

You are all set. Restarting your Apache server will reload it with all of your changes in place. 
sudo service apache2 reload

In your browser, type https://youraddress, and you will be able to see the new certificate.

INITIAL BEANSTALK GIT COMMIT TO MASTER BRANCH

Getting Started with Git & Creating your Repository

After you have installed Git, you need to setup the repository in your account and generate an SSH key.
yum install git-core (this is for centos)
apt-get install git-core (this is for ubuntu )

Once installed, we recommend initializing Git. run the following commands.
git config --global user.name "kirthan"
git config --global user.email "kirthan@example.com"

Use your full name and email address, and by this you will setup Git for your purposes. You need to do this only once, the first time you install Git.

Start using Git

There are many different ways to use your Git repository. Since Git is very flexible you can start using your repository easily by importing, cloning, and many other ways.
We will show you couple of common ways to start using your Git repository.

Starting from scratch

To start using your repository from scratch, in your command line type the following:
mkdir my-project
cd my-project
git init
echo "This is my new project on Beanstalk." > README
git add README
git commit -m "My first commit."
git remote add beanstalk https://example.git.beanstalkapp.com/my-project.git
git push beanstalk master

With the commands above, you will create a folder, add a file to it, make your first commit, and push the changes to your repository, to master branch. Master branch is the default branch to use for your files.

Import existing files on your computer

To import your existing files from your local machine type the following in your command line:
cd my-project
git init
git remote add beanstalk https://example.git.beanstalkapp.com/my-project.git

git add .
git commit -m "Importing my project to Git, without saving history."
git push beanstalk master

Installing Redmine on CentOS 6.2

Installing Redmine on CentOS 6.2 Wiht MySQL and Apache

I needed recently to install the excellent project management tool Redmine on a CentOS 6.2 machine. There are some tutorials on the Web (here or here) but they are a little bit outdated. The following is a method that works as of today.

Pre-requisites

Logged as root, install the following packages:
1
yum install make gcc gcc-c++ zlib-devel ruby-devel rubygems ruby-libs apr-devel apr-util-devel httpd-devel mysql-devel mysql-server automake autoconf ImageMagick ImageMagick-devel curl-devel
And then install the bundle ruby gem:
1
gem install bundle

Install Redmine

Redmine is installed with the following commmands:
1
2
3
4
5
cd /var/www
wget http://rubyforge.org/frs/download.php/76255/redmine-1.4.4.tar.gz
tar zxf redmine-1.4.4.tar.gz
ln -s redmine-1.4.4 redmine
rm -f redmine-1.4.4.tar.gz

Install Redmine ruby dependencies

Bundle helps us install the ruby Redmine dependencies:
1
2
cd /var/www/redmine
bundle install --without postgresql sqlite test development

Database creation

First we start MySQL:
1
service mysqld start
Then we secure it (Optional):
1
mysql_secure_installation
We then create the redmine database and user:
1
2
3
4
5
$ mysql
mysql> create database redmine character set utf8;
mysql> grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
mysql> flush privileges;
mysql> quit

Redmine database configuration

We copy the database configuration example and we modify it to point to our newly created database:
1
2
cd /var/www/redmine/config
copy database.yml.example database.yml
On the database.yml file, the production section should look like this:
1
2
3
4
5
6
7
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: my_password
  encoding: utf8
And then we create and populate the database with the following rake commands:
1
2
3
4
cd /var/www/redmine
rake generate_session_store
rake db:migrate RAILS_ENV="production"
rake redmine:load_default_data RAILS_ENV="production"

Outgoing email configuration (Optional)

To configure an outgoing SMTP server for sending emails, we create the config/configuration.yml file from the sample:
1
2
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
And edit it to provide our configuration :
1
2
3
4
5
6
7
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "smtp.mydomain.com"
      port: 25
      domain: "mydomain.com"

Redmine standalone testing

At this point, Redmine can be tested in standalone mode by running the following command:
1
2
cd /var/www/redmine/
ruby script/server webrick -e production
and open the http://localhost:3000 addess in a browser. If you are testing from another computer, you will need to open the port in the /etc/sysconfig/iptables file by duplicating the ssh (port 22) line and adapting it:
1
2
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
Then apply the new configuration with the following command:
1
service iptables restart

Passenger installation

To install Phusion passenger, we firts install its gem:
1
gem install passenger
And then install the Apache module with the command:
1
passenger-install-apache2-module

Apache configuration

We remove the default Apache configuration and replace it by a new one:
1
2
3
cd /etc/httpd
mv conf.d available
mkdir conf.d
In the empty new conf.d folder, we create a redmine.conf file with the following configuration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Loading Passenger
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.13
PassengerRuby /usr/bin/ruby

<VirtualHost *:80>
   ServerName redmine.mycompany.com
   DocumentRoot /var/www/redmine/public
   <Directory /var/www/redmine/public>
      # This relaxes Apache security settings.
      AllowOverride all
      # MultiViews must be turned off.
      Options -MultiViews
      allow from all
   </Directory>

   ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/redmine-error.%Y-%m-%d.log 86400"
   CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/redmine-access.%Y-%m-%d.log 86400" "%h %l %u %t %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""

</VirtualHost>
We then enable named based virtual hosting for our server by uncomenting the following line in the /etc/httpd/conf/httpd.conf file:
1
2
3
4
5
6
...
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
...
We give full access on the redmine folder to the apache user and test the configuration:
1
2
chown -R apache:root /var/www/redmine
service httpd configtest
At this point, the SELinux configuration needs to be modified to allow our apache instance to run the phusion passenger module. You can do this by putting SELinux in permissive mode:
1
setenfore Permissive
And letting the Permissive mode survive a reboot by modifyin the /etc/selinux/config file from:
1
SELINUX=enforcing
to
1
SELINUX=permissive
If you want to run redmine while enforcing, you may want to apply the method described here for which you will need to install the policycoreutils-python package.
In any case, you will start Apache with the command:
1
service httpd start
Now you can access your Redmine installation with your browser. To access it from all the computers in your network, you will need to open the port 80 in the /etc/sysconfig/iptables. You can replace the 3000 rule by :
1
2
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
And restart iptables.
1
service iptables restart

Start services at boot

To have MySQL and Apache started at boot, run the commands:
1
2
chkconfig --level 345 mysqld on
chkconfig --level 345 httpd on

Cleaning up

A quick command to clean up all the devel stuff needed for installation:
1
yum remove '*-devel' make automake autoconf

Tips

Don’t forget that if you change your Redmine configuration, you don’t have to restart Apache. Your can restart only Redmine with the command:
1
touch /var/www/redmine/tmp/restart.txt
If you restore data on your server from another redmine instance that runs on a previous version, dont forget to migrate your data:
1
2
cd /var/www/redmine
rake db:migrate RAILS_ENV="production"

Kill process in Linux or terminate a process in Linux systems

Kill process using kill command under Linux/UNIX

kill command works under both Linux and UNIX/BSD like operating systems.

Step #1: First, you need to find out process PID (process id)

Use ps command or pidof command to find out process ID (PID). Syntax:
ps aux | grep processname
pidof processname

For example if process name is lighttpd, you can use any one of the following command to obtain process ID:
# ps aux | grep lighttpd
# pidof lighttpd
Output:
3486

Step #2: kill process using PID (process id)

Above command tell you PID (3486) of lighttpd process. Now kill process using this PID:
# kill 3486
OR
# kill -9 3486
Where,
  • -9 is special Kill signal, which will kill the process.

killall command examples

DO NOT USE killall command on UNIX system (Linux only command). You can also use killall command. The killall command kill processes by name (no need to find PID):
# killall -9 lighttpd
Kill Firefox process:
# killall -9 firefox-bin
 

Installing Zend Server Community Edition (CE) on Ubuntu

Installing Zend Server Community Edition (CE) on Ubuntu With Phpmyadmin .


Start by adding the official Zend debs to your distribution.
-------------------------------------------------------------------------------------------------
sudo nano /etc/apt/sources.list
 -------------------------------------------------------------------------------------------------

And the following snipplet in the bottom of the file
  -------------------------------------------------------------------------------------------------
deb http://repos.zend.com/zend-server/deb server non-free
-------------------------------------------------------------------------------------------------

Add the Zend’s repository public key

-------------------------------------------------------------------------------------------------
wget http://repos.zend.com/zend.key -O- | sudo apt-key add -
 -------------------------------------------------------------------------------------------------

Now synchronize the repositories

-------------------------------------------------------------------------------------------------
sudo apt-get update
 -------------------------------------------------------------------------------------------------

Finally install Zend Server with PHP 5.3

-------------------------------------------------------------------------------------------------
sudo apt-get install zend-server-ce-php-5.3
-------------------------------------------------------------------------------------------------

All done, you now have Zend Server Community Edition installed!

Now we are Mysql
-------------------------------------------------------------------------------------------------
And then MySQL:

#apt-get install mysql-server

#service mysqld start

#mysql_install_db

#/usr/bin/mysql_secure_installation

#chkconfig --levels 235 mysqld on





Install phpmyadmin : 

#apt-get install phpmyadmin-zend-server-php-5.3
-------------------------------------------------------------------------------------------------
#vi /usr/local/zend/gui/lighttpd/etc/lighttpd.conf
Search for 'phpmyadmin' and you should find the following code block:
$HTTP["remoteip"] !~ "127.0.0.1" {
  $HTTP["url"] =~ "^/phpmyadmin/" {
    url.access-deny = ( "" )
    server.errorfile-prefix = "//usr/local/zend/gui/lighttpd/share/lighttpd-custom-errors/errorcode-"
  }
}
 
To disable the security completely, you can simply comment out this block. Alternatively, just replace the IP Address with your own. Finally, we need to add Zend's bin and lib directories to the system path and restart Zend.
-------------------------------------------------------------------------------------------------
#vi /etc/profile

 Add the following lines to the very end of this file:
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
-------------------------------------------------------------------------------------------------

Start and Stop ssh-agent

Below is the bash script used to start and stop ss-agent #!/bin/bash ## in .bash_profile SSHAGENT=`which ssh-agent` SSHAGENTARGS="...