Saturday, April 25, 2020

How to install MySql on Ubuntu 18.04




                                     How to install MySql on Ubuntu 18.04



Update Ubuntu

    # sudo apt-get update



Upgrade Ubuntu:

    #sudo apt-get upgrade




Check MySql is installed or not:

    #mysql –version



If MySql is not installed then:


Install Mysql Server:

    #sudo apt-get install mysql-server





Check the status of MySql:

    #sudo systemctl status mysql


Install MySql (Secure):

    #sudo mysql_secure_installation


Run MySql:

    #sudo mysql







==================== Enjoy ================================


Thursday, April 23, 2020

How to install vlc on Ubuntu 18.04 by snap




VLC is a open source cross-platform media player that plays most multimedia files.


=> Check snapd is installed or not:

#snap version



=> if snapd is installed then:


#sudo snap install vlc



=> It will install VideoLAN software.

Go to Application (Bottom left)
          Search Bar
              Type: vlc



You will get your media player









How to install snap on Ubuntu 18.04




Snap is a software deployment and package management system.
We will install snapd.



#sudo apt-get update

 

#sudo apt-get upgrade



=> Check snapd is installed or not:



#snap version



=> If snapd is not installed then:

#sudo apt-get install snapd







=> After installation again check:


#snap version
 





 => Install other package by snap:


#sudo snap install <pkg name>



=>It will install your required software/app




===================== Enjoy ==============



Tuesday, April 7, 2020

How to install Sublime text editor on CentOS7


## Sublime text editor installation on CentOS: 7


Check Sublime text editor installed or not:

#subl --version

[root@localhost ~]# subl --version
Sublime Text Build 3210

If its not installed then:


1. Update your Linux by command line:

# yum -y update



2. Import GPG key

sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg

[root@localhost ~]# sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg



3. Download Subline repos:


[root@localhost ~]# sudo wget -P /etc/yum.repos.d/ https://download.sublimetext.com/rpm/dev/x86_64/sublime-text.repo



4. Install DNF package for installing sublime text editor:

# yum -y install dnf

[root@localhost ~]# yum -y install dnf


5. Install Sublime text editor:

#sudo dnf install sublime-text

[root@localhost ~]# sudo dnf install sublime-text


6. Check:

#subl --version

[root@localhost ~]# subl --version
Sublime Text Build 3210



7. Run Sublime text editor

#subl



## Open an editor




== Enjoy your new editor ===


Saturday, April 4, 2020

How to Check and Verify Python on CentOS7


Run CenOS7

Open Terminal:

# python --version

[root@localhost ~]# python --version
Python 2.7.5


Run Python:

#python

root@localhost ~]# python
Python 2.7.5 (default, Aug  7 2019, 00:51:29) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 



Help Command:

>>>help()

>>> help()

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help>


Quit from help command line:

help> quit

help> quit

Simple Program:

>>>print ("Hello World")

>>> print ("Hello World")
Hello World
>>> 


Quit from Python:

>>>quit()

>> 
>>> quit()
[root@localhost ~]# 



=== End ===


Wednesday, June 17, 2015

How to install and configure Opensips with authentication on Ubuntu-14.10:




Used OS: Ubuntu 14.10 (64 Bit)


Update OS :

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential openssl bison flex
sudo apt-get install mysql-server libmysqlclient-dev

Must know your mysql root password

Download the opensips from http://opensips.org/ site

cd /usr/src
wget http://opensips.org/pub/opensips/1.8.0/src/opensips-1.8.0_src.tar.gz

tar -zxvf opensips-1.8.0_src.tar.gz

cd opensips-1.8.0-tls

Compile the Opensips:
we will compile Opensips with all available modules:

make all include_modules="db_mysql" modules
make install include_modules="db_mysql" modules

Now copy the files from the extracted directory to the followings:

cp /usr/src/opensips-1.8.0-tls/packaging/debian/opensips.default /etc/default/opensips
cp /usr/src/opensips-1.8.0-tls/packaging/debian/opensips.init /etc/init.d/opensips


Modify following changes:

vi /etc/default/opensips

RUN_OPENSIPS=yes
USER=opensips                                //User to run as
GROUP=opensips                            //Group to run as
MEMORY=64                           //128 (Optional)


Modify following file:

vi /etc/init.d/opensips

DAEMON=/usr/local/sbin/opensips
       save and exit

Provide executable permission:
chmod +x /etc/init.d/opensips

Create opensips user:
adduser opensips
Pass: *******

Now create the dir (for PID file):
mkdir /var/run/opensips

Configuring the Opensips:
=========================
Change the file in /usr/local/etc/opensips/opensipsctlrc:
vi /usr/local/etc/opensips/opensipsctlrc

Make the following change:
SIP_DOMAIN=localhost
DBENGINE=MYSQL
DBHOST=localhost
DBNAME=opensips
DBRWUSER=opensips
DBRWPW="opensipsrw" //Database password
DBROUSER=opensipsro
DBROPW=opensipsro
DBROOTUSER="root"
USERCOL="username"
INSTALL_EXTRA_TABLES=ask
INSTALL_PRESENCE_TABLES=ask
INSTALL_SERWEB_TABLES=ask
CTLENGINE="FIFO"
OSIPS_FIFO="/tmp/opensips_fifo"
PID_FILE=/var/run/opensips/opensips.pid


Create database:
opensipsdbctl create
Password: <mysql password>                    //Ask for the root mysql password.

Configuring Mysql support:

Change the opensips.cfg:

vi /usr/local/etc/opensips/opensips.cfg
loadmodule "db_mysql.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("usrloc", "db_mode", 0); #THIS LINE MUST TO BE COMMENTED
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")                                                                                                    /*/opensipsrw == <Opensip's DB password>

Add following for auth_db params:
Add or uncomment the following lines if you want to enable the DB based authentication:

modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
                                                                                    /*/opensipsrw == <Opensip's DB password>

//Add following lines for authentication (opensips.cfg)
243         if (is_method("REGISTER"))
244         {
245         ##### following(in-between ##) lines required for auth/register
246                 if (!www_authorize("", "subscriber")) {
247                   www_challenge("", "0");
248                   exit;
249                 }
250         #####
251
252                 if (   0 ) setflag(7);
253
254                 if (!save("location"))
255                         sl_reply_error();
256
257                 exit;
258         }



Create the opensips/softphone user:
opensipsctl add test1 test
opensipsctl add 123 123 //user pass == 123 123

Create the Opensips user in the Mysql:

mysql> GRANT ALL PRIVILEGES ON *.* TO opensips@localhost IDENTIFIED BY '<opensips/Password>';

GRANT ALL PRIVILEGES ON *.* TO opensips@127.0.0.1 IDENTIFIED BY '<opensips/Password>';


Starting/Run OpenSIPS:

There are two ways:

1. /etc/init.d/opensips start | stop
2. opensipsctl start | stop



========================== Enjoy ===============================

Tuesday, November 4, 2014

How to change "Ethernet" card's speed in Linux.

Check the NIC cards speed and other attributes.
#ethtool eth0
Settings for eth1: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) Link detected: yes // Supported link must be 1000 for Gigabit support.
To force a speed change to 1000Mbps, full duplex mode, run:
# ethtool -s eth0 speed 1000 duplex full autoneg off

== Permanent  solutions =
vi /etc/sysconfig/network-scripts/ifcfg-eth0:

   ETHTOOL_OPTS="speed 1000 duplex full autoneg off"     //Set ETHTOOL_OPT value.
Restart the interface to apply changes: # ifdown eth0 && ifup eth0

check:
https://iperf.fr //you will get testing tool.
==========Check from windows Windows ==============
Check windows ethernet speed: C:\Users\Administrator.LDC13>wmic NIC where NetEnabled=true get Name, Speed Name Speed Realtek PCIe GBE Family Controller 1000000000



How to be a ssh root user for Ubuntu.

How to be a ssh root user for Ubuntu.


First log in at a user:

login as: nixproo
nixpro@202.53.1**.1**'s password: ******

noxproo@ubuntu:/$ sudo su          //logged in by root user
[sudo] password for nixpro: ****** //Provide the root password



root@ubuntu:/# sudo -i
root@ubuntu:~# sudo passwd root


Enter new UNIX password: ******
Retype new UNIX password:******

passwd: password updated successfully

root@ubuntu:~# vi /etc/ssh/sshd_config

 28 ## PermitRootLogin without-password //Comment this line
 29 PermitRootLogin yes        // Set PermitRootLogin no to yes
 30 StrictModes yes


root@ubuntu:~# sudo service ssh restart

ssh stop/waiting
ssh start/running, process *****



Use putty or other ssh client and log-in as a root user.

Thursday, July 24, 2014

How to create self signed tls certificate and use to enable tls for Asterisk:

How to create self signed tls certificate:


Open Terminal:

[root@nixproo]# yum -y update
[root@nixproo]# yum -y upgrade                   //It will take taimes

Install Openssl and Openssl-devel:

[root@nixproo]# yum install openssl openssl-devel
      

[root@nixproo]# mkdir certificate
[root@nixproo]# cd certificate/
[root@nixproo certificate]# openssl genrsa -out key.pem 1024
Generating RSA private key, 1024 bit long modulus
.................++++++
.....................++++++
e is 65537 (0x10001)
[root@nixproo certificate]# ls
key.pem

[root@nixproo certificate]# openssl req -new -key key.pem -out request.pem

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) [XX]:CA
State or Province Name (full name) []:VA
Locality Name (eg, city) [Default City]:VA
Organization Name (eg, company) [Default Company Ltd]:NP
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:nixproo
An optional company name []:

[root@nixproo certificate]# ls
key.pem  request.pem

[root@nixproo certificate]# openssl x509 -req -days 3650 -in request.pem -signkey key.pem -out certificate.pem

Signature ok
subject=/C=BD/ST=DH/L=DH/O=EB/OU=IT
Getting Private key

[root@nixproo certificate]# ls
certificate.pem  key.pem  request.pem


[root@nixproo certificate]# cp certificate.pem asterisk.pem
[root@nixproo certificate]# cat key.pem >> asterisk.pem

[root@nixproo certificate]# vi /etc/asterisk/sip.conf        //With Line number

 210 tcpenable=yes
 211 tcpbindaddr=0.0.0.0        //Default port:5060
 214 tlsenable=yes
 215 tlsbindaddr=0.0.0.0        //Default port:5061

 542 tlscertfile=/etc/asterisk/certificate/asterisk.pem
 561 tlsdontverifyserver=no
 567 tlscipher=DES-CBC3-SHA    
 571 tlsclientmethod=tlsv1


Finally, go to (In sip.conf) one of your sip client contexts and add:
transport=tls

Save and exit the sip.conf file.


=== Run Server ==

#asterisk -r or asterisk -vvvvvvvvvvvgc

nixproo*CLI> sip reload
SSL certificate ok




How to install smartgit on Ubuntu-14.04


How to install smartgit on Ubuntu-14.04

Open terminal and use following commands.

Add Repo:
sudo add-apt-repository ppa:eugenesan/ppa
 


Update Repo:
sudo apt-get update
 


Install SmartGit:
sudo apt-get install smartgithg


Run SmartGit:

Find the location of binary file and do following:

./smartgithg


 

How to install Oracle Java 7 or Java 8 on Ubuntu-14.04


How to install Oracle Java8 on Ubuntu-14.04

Go to Terminal and use foolowing commands. 
 
Add Repo:
sudo add-apt-repository ppa:webupd8team/java
 

Update Repo:
sudo apt-get update


Install JAVA:
sudo apt-get install oracle-java8-installer



How to install Oracle Java 7 on Ubuntu-14.04


Go to Terminal and use foolowing commands. 
 
Add Repo:
sudo add-apt-repository ppa:webupd8team/java
 

Update Repo:
sudo apt-get update
 

Install JAVA:
sudo apt-get install oracle-java7-installer


 

How to install Skype on Ubuntu-14.04


How to install Skype on Ubuntu-14.04

Open terminal and use following commands.

Repo Add:
sudo sh -c ‘echo “deb http://archive.canonical.com/ubuntu trusty partner” >> /etc/apt/sources.list.d/canonical_partner.list’

Update Repo:
sudo apt-get update

Install Skupe over terminal:
sudo apt-get install skype 

Go to Find:  Skype

 

Thursday, May 15, 2014

How to install RTL8188CE (Asus-PCE-N15) Wifi device on Centos 6.x.


How to install RTL8188CE (Asus-PCE-N15) Wifi device on Centos 6.x.


1. Find the name the wireless devices

 lspci or lspci | egrep -i --color 'network|ethernet'

    05:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)


2. Found that RTL8188CE:
   
    lspci -nn | grep RTL8188CE. Got this result:
    03:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n     WiFi Adapter [10ec:8176] (rev 01)

3. Create directory:
    mkdir /etc/rpm-gpg/

4. enter directory:
    cd /etc/rpm-gpg/

5. Import the ElRepo Key:

    rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

6. Verify the key by checking it's fingerprint matches the fingerprint listed here before installing it:
    gpg --quiet --with-fingerprint RPM-GPG-KEY-elrepo.org
    pub 1024D/BAADAE52 2009-03-17 elrepo.org (RPM Signing Key for elrepo.org) <secure@elrepo.org>
    Key fingerprint = 96C0 104F 6315 4731 1E0B B1AE 309B C305 BAAD AE52
    sub 2048g/B8C66E6D 2009-03-17

7. Import the Key (for proper directory):
    rpm --import RPM-GPG-KEY-elrepo.org

8. Install ELRepo for RHEL-6, SL-6 or CentOS-6:

    wget http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
    wget http://elrepo.org/linux/elrepo/el6/i386/RPMS/elrepo-release-6-6.el6.elrepo.noarch.rpm        //32 Bit
    wget http://elrepo.org/linux/elrepo/el6/x86_64/RPMS/elrepo-release-6-6.el6.elrepo.noarch.rpm        //64 Bit
   
    rpm -Uvh elrepo-release*
   
    Or

    rpm -Uvh http://elrepo.org/linux/elrepo/el6/x86_64/RPMS/elrepo-release*rpm

    Got this:
    Retrieving http://www.elrepo.org/elrepo-release-6- ... noarch.rpm
    Preparing... ########################################### [100%]
    1:elrepo-release ########################################### [100%]

9. Install the driver (using rtl8192ce):
    yum install kmod-r8192ce
    The last lines of the result:
    Installed:
    kmod-r8192ce.x86_64 0:0006.0321.2011-1.el6.elrepo
   Complete!

    Or

    wget http://elrepo.org/linux/elrepo/el6/i386/RPMS/kmod-r8192ce-0006.0321.2011-1.el6.elrepo.i686.rpm        //32 Bit
    rpm -Uvh kmod-r8192ce-0006.0321.2011-1.el6.elrepo.i686.rpm

    http://elrepo.org/linux/elrepo/el6/x86_64/RPMS/kmod-r8192ce-0006.0321.2011-1.el6.elrepo.x86_64.rpm        //64 Bit
    rpm -Uvh kmod-r8192ce-0006.0321.2011-1.el6.elrepo.x86_64.rpm


Complete!

10. Reboot the system/computer.

Wow I got the Wi-fi device.

Sunday, May 11, 2014

How to install and configure OpenVPN on CentOS with routing


=========                             =========
========= OpenVPN Server =========

yum install openssl
yum install openssl-devel
yum install libssl-devel

 
 cd /usr/local/src/
 wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz
 wget http://swupdate.openvpn.org/community/releases/openvpn-2.2.2.tar.gz    

 
  cd /usr/local/src/
 
  tar -zxvf /usr/local/src/lzo-2.06.tar.gz
  cd lzo-2.06/
  ls
 ./configure
  make
  make install
 
  cd ..
  tar -zxvf /usr/local/src/openvpn-2.2.2.tar.gz
  ls
  cd openvpn-2.2.2/
   ./configure
  make
  make install

  mkdir /etc/openvpn
 
 cd /usr/local/src/openvpn-2.1.1/easy-rsa/2.0                    

vi vars


     64 export KEY_COUNTRY="BD"
     65 export KEY_PROVINCE="DH"
     66 export KEY_CITY="Dhaka"
     67 export KEY_ORG="nixproo"
     68 export KEY_EMAIL="bashar@nixproo.com"


[root@nixproo 2.0]# . ./vars
[root@nixproo 2.0]# ./clean-all
[root@nixproo 2.0]# ./build-ca

Generating a 1024 bit RSA private key
...................................++++++
..++++++
writing new private key to 'ca.key'
-----
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) [BD]:
State or Province Name (full name) [DH]:.
Locality Name (eg, city) [Dhaka]:
Organization Name (eg, company) [nixproo]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) [nixproo CA]:nixproo-CA
Name []:Bashar
Email Address [bashar@nixproo.com]:bashar@nixproo.com
[root@nixproo 2.0]#



[root@nixproo 2.0]# ./build-key-server server
Generating a 1024 bit RSA private key
...........................................++++++
...............++++++
writing new private key to 'server.key'
-----
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) [BD]:
State or Province Name (full name) [DH]:
Locality Name (eg, city) [Dhaka]:
Organization Name (eg, company) [nixproo]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) [server]:
Name []:Bashar
Email Address [bashar@nixproo.com]:bashar@nixproo.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:nixproo
An optional company name []:test
Using configuration from /root/openvpn-2.1.1/easy-rsa/2.0/openssl.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'BD'
stateOrProvinceName   :PRINTABLE:'DH'
localityName          :PRINTABLE:'Dhaka'
organizationName      :PRINTABLE:'nixproo'
commonName            :PRINTABLE:'server'
name                  :PRINTABLE:'Bashar'
emailAddress          :IA5STRING:'bashar@nixproo.com'
Certificate is to be certified until Dec 24 04:58:46 2021 GMT (3650 days)
Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

[root@nixproo 2.0]# ./build-key client1
Generating a 1024 bit RSA private key
.++++++
........++++++
writing new private key to 'client1.key'
-----
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) [BD]:
State or Province Name (full name) [DH]:
Locality Name (eg, city) [Dhaka]:
Organization Name (eg, company) [nixproo]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) [client1]:
Name []:Bashar
Email Address [bashar@nixproo.com]:bashar@nixproo.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:nixproo
An optional company name []:test
Using configuration from /root/openvpn-2.1.1/easy-rsa/2.0/openssl.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'BD'
stateOrProvinceName   :PRINTABLE:'DH'
localityName          :PRINTABLE:'Dhaka'
organizationName      :PRINTABLE:'nixproo'
commonName            :PRINTABLE:'client1'
name                  :PRINTABLE:'Bashar'
emailAddress          :IA5STRING:'bashar@nixproo.com'
Certificate is to be certified until Dec 24 05:01:19 2021 GMT (3650 days)
Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated


[root@nixproo 2.0]# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
............................+.......................................................
....+........................................................+...............+.............+........
................+...................................................................................
.............................+....................+....................................+.+.....+.........++*++*++*
Copy all the client key files into the local VPN client PC and paste on /etc/openvpn/keys/


[root@nixproo 2.0]# openvpn --genkey --secret ta.key

cp -r /usr/local/src/openvpn-2.1.1/easy-rsa/2.0/keys /etc/openvpn/

Copy also ta.key files into the local VPN client PC and paste on /etc/openvpn/keys/

vi /etc/openvpn/ipp.txt

client1,192.168.50.4
client2,192.168.50.12
client3,192.168.50.20



vi /etc/openvpn/server.conf               //With line number

26 local <Server IP>
34 port 1194
38 proto udp
55 dev tun

80 ca /etc/openvpn/keys/ca.crt
81 cert /etc/openvpn/keys/server.crt
82 key /etc/openvpn/keys/server.key
91 dh /etc/openvpn/keys/dh1024.pem

100 server 10.8.0.0 255.255.255.0
107 ifconfig-pool-persist ipp.txt
 

 128 push "route 192.168.18.0 255.255.255.0"            //Added block for push route
 129 push "route 192.168.0.0 255.255.255.0"
 130 push "route 192.168.10.0 255.255.255.0"

 
 224 keepalive 10 120
 237 tls-auth /etc/openvpn/keys/ta.key 0 # This file is secret
 249 comp-lzo
 292 verb 6
 297 mute 20




== Run OpenVPN Server ==

cp /usr/local/src/openvpn-2.1.1/openvpn /etc/init.d/                     // copy the binary into the service dir.    

/usr/local/src/openvpn-2.1.1/openvpn /etc/openvpn/server.conf    
Or
/etc/init.d/openvpn /etc/openvpn/server.conf 

                                                                                                      // tun0 created with 10.8.0.1 IP



==========                                =========================
==========  Open VPN Client  =========================

    cd /usr/local/src/
 
    yum install openssl
    yum install openssl-devel
    yum install libssl-devel
 
  wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz
  wget http://swupdate.openvpn.org/community/releases/openvpn-2.2.2.tar.gz

  cd /usr/local/src/
 
  tar -zxvf /home/lzo-2.06.tar.gz
  cd lzo-2.06/
  ls
 ./configure
  make
  make install
 
  cd ..
  tar -zxvf /home/openvpn-2.2.2.tar.gz
  ls
  cd openvpn-2.2.2/
  ls
 
  ./configure
  make
  make install

  mkdir /etc/openvpn
 
  cd /etc/openvpn/      
                                  // copy keys folder form server and past in /etc/openvpn/
 
 
vi /etc/openvpn/client.con                          // With line number

 16 client
 24 dev tun
 37 proto udp
 42 remote <Server IP>
 58 nobind
 65 persist-key
 66 persist-tun
 
 91 ca /etc/openvpn/keys/ca.crt
 92 cert /etc/openvpn/keys/client1.crt
 93 key  /etc/openvpn/keys/client1.key
 106 ns-cert-type server
 111 tls-auth /etc/openvpn/keys/ta.key 1
 
 121 comp-lzo
 124 verb 3




  cp /usr/local/src/openvpn-2.2.2/openvpn /etc/init.d/
 
 ===== run openVPN Client ====

  /etc/init.d/openvpn /etc/openvpn/client.conf      // tun0 created with 10.8.0.5 IP <ip taken from ipp  

============                  ========================
============ Routing   ========================                                                             


=== VPN server ===


iptables -t nat -F
echo 1 > /proc/sys/net/ipv4/ip_forward
route add -net 192.168.18.0 netmask 255.255.255.0 dev tun0                    
// Add Clients block (18)
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE


Or

iptables -t nat -F
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth0 -d <Server IP>  -j DNAT --to 10.8.0.6        
iptables -t nat -A POSTROUTING -s 10.8.0.6 -o eth0 -j SNAT --to <Server IP>
route add -net 10.8.0.0 netmask 255.255.255.0 dev tun0

 

=== Local VPN PC (Local VPN GW PC) ===

iptables -t nat -F
echo 1 > /proc/sys/net/ipv4/ip_forward
route add -net <Server IP> netmask 255.255.255.255 gw <Local GW IP>    // route -n  <Local gw>
route del default gw  <Local GW IP>
route del -net 192.168.18.0 netmask 255.255.255.0 dev tun0      
route add default dev tun0
iptables -A POSTROUTING -t nat -o tun0 -j MASQUERADE


                                        // Local VPN Client work as a local VPN GW

=============================               ===================================
============================= Testing  ====================================

ping -I tun0 8.8.8.8                                                       // ping from VPN-Client PC

Monday, April 21, 2014

How to install Virtualbox on CentOS6x (64 Bit)


How to install Virtualbox on CentOS6x (64 Bit):

## RHEL 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6 and CentOS 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6 ##

cd /etc/yum.repos.d/
 wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo



Install Dependencies:
 yum -y groupinstall Desktop
 

yum -y install qt qt-devel SDL-devel tigervnc-server gcc make kernel-devel dkms
 
uname -r
2.6.32-431.11.2.el6.x86_64                            //Kernel version
 
export KERN_DIR=/usr/src/kernels/2.6.32-431.11.2.el6.x86_64 

yum -y update

yum install VirtualBox-4.3 
<or>
wget http://download.virtualbox.org/virtualbox/4.3.8/VirtualBox-4.3-4.3.8_92456_el6-1.x86_64.rpm

rpm -ivh VirtualBox-4.3-4.3.8_92456_el6-1.x86_64.rpm


Installation Process:
warning: VirtualBox-4.3-4.3.8_92456_el6-1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY
Preparing...                ########################################### [100%]
   1:VirtualBox-4.3         ########################################### [100%]

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.
Stopping VirtualBox kernel modules [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS
 [  OK  ]
Starting VirtualBox kernel modules [  OK  ]



Note: By Defaull it works for 32 bit OS


Error (64 Bit PC): “This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to boot – please use a kernel appropriate for your CPU”


For 64 bit OS (Enable virtulization):

Start or Restart PC:
Press a key (such as F2, F12, Delete, or Esc) Go to BIOS
--> Go to CPU information.
--> Enable Virtualization.
--> Save and exit


Then it will work for 64 bit OS.

How to install & configure epel repo on Centos 6.x


How to install & configure epel repo on Centos 6.x (64 Bit):



Download epel RPM:
 wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 

Install epel rpms:
rpm -ivh  epel-release-6-8.noarch.rpm
rpm -ivh  remi-release-6.rpm

Update rpms if previously installed:
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

We should see some additional repo definitions under the /etc/yum.repos.d directory.
 # ls -1 /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo
 /etc/yum.repos.d/epel.repo
/etc/yum.repos.d/epel-testing.repo
/etc/yum.repos.d/remi.repo


Enable the remi repository:
Open the /etc/yum.repos.d/remi.repo repository file using a text editor of your choice:

vi /etc/yum.repos.d/remi.repo

Edit the [remi] portion of the file so that the enabled option is set to 1.

name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority


Save and exit.

yum -y update
yum -y upgrade

Monday, April 14, 2014

How to install Asterisk on Lubuntu.



Install Asterisk on lubuntu-12.04 (64Bit)

Install related packages. 
sudo apt-get install build-essential
sudo apt-get install php5-mysql libapache2-mod-php5 mysql-server libmysqlclient15-dev php-db   php5-gd php-pear sox curl g++ libncurses-dev libxml2-dev subversion



Download Asterisk:
 wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/releases/certified-asterisk-1.8.15-cert5.tar.gz
 tar -zxvf certified-asterisk-1.8.15-cert5.tar.gz 

 cd certified-asterisk-1.8.15-cert5

Install Asterisk:
  ./configure
  make
  make install
  make config
  make samples


Test Asterisk:

Go to terminal (Command Prompt)

asterisk -r


It will work.

How to install TeamViewer & remastersys on Lubuntu


Install TeamViewer on Lubuntu 12.04 (64Bit)

 
wget http://download.teamviewer.com/download/teamviewer_linux_x64.deb
sudo gdebi teamviewer_linux_x64.deb



Go to ==> Menu  ==> Internet  ==> teamviewer











Install remastersys on lubuntu-12.04 (64Bit)

sudo apt-get install remastersys



Go to ==> Menu  ==> System  ==> remastersys.


How to install Skype on Lubuntu.



Install Skype on Lubuntu 12.04 (Stable)

sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update

sudo apt-get install skype



Go to => Menu => Internet => Skype.

It will work

Tuesday, March 25, 2014

How to mount NTFS partition on CentOS(6.x)





How to mount NTFS partition on CentOS(6.x) 


 Enter as a root user

 yum install ntfs-3g

fdisk -l /dev/sda                                                                               //Check the partition   //1st HDD

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13       97280    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2              13       10849    87040000    7  HPFS/NTFS
/dev/sda3           10849       24516   109780992    7  HPFS/NTFS
/dev/sda4           24516       60802   291466240    5  Extended
/dev/sda5           42659       60802   145731584    7  HPFS/NTFS
/dev/sda6           24516       24580      512000   83  Linux
/dev/sda7           24580       42658   145214464   8e  Linux LVM



 fdisk -l /dev/sdb                                                                                  //Check the partition   //2nd HDD

Disk identifier: 0xf113c31a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        7650    61440000    7  HPFS/NTFS
/dev/sdb2            7650       33146   204800000    7  HPFS/NTFS
/dev/sdb3           33146       60682   221184000    7  HPFS/NTFS
/dev/sdb4           60682       60802      961560    5  Extended
/dev/sdb5           60682       60802      960512   8e  Linux LVM



  modprobe fuse

Create folder for mounting NTFS partition:

  mkdir /mnt/ntfs1
  mkdir /mnt/ntfs2
  mkdir /mnt/ntfs3   
                                                                                        //As much as your need.


Mount NTFS partition(sda or sdb):

  mount -t ntfs-3g /dev/sda1 /mnt/ntfs1
  mount -t ntfs-3g /dev/sda2 /mnt/ntfs2

  mount -t ntfs-3g /dev/sdb3 /mnt/ntfs3


----So On ---

Enter the NTFS partition:

cd /mnt/ntfs1
cd /mnt/ntfs2


--You will get all content of NTFS pertition


===Unmount==

umount /mnt/ntfs1