Posts Tagged ‘linux’

Setup OpenVPN Client in Linux

April 23, 2012 4 comments

I needed to install OpenVPN(open source virtual private network) in my Linux machine to be able to access our staging server. OpenVPN allows you to establish a secure point to point  access to network resources and services.

OpenVPN can be used in two ways – Server and Client. OpenVPN server is the system that you wish to use as VPN end-point or the one you want to access. In my case what I needed to do is to install OpenVPN as client or the one making a service request.

1. Install OpenVPN using terminal:

sudo apt-get install openvpn

2. Create client configuration file in /etc/openvpn

sudo cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn

3. Setup client config file, server keys and certificates in /etc/openvpn folder (in my case our client sent these files generated from the server)


4. Edit client configuration file (client.conf) based on above directory

# example client config file
remote [server] 1194
dev tun
proto udp

ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/hostname.crt
key /etc/openvpn/keys/hostname.key
ns-cert-type server
tls-auth /etc/openvpn/keys/ta.key 1

keepalive 10 60

verb 3

5. Go to /etc/openvpn folder and start the OpenVPN

exist@exist:/etc/openvpn$ sudo openvpn client.conf
Mon Apr 23 13:44:43 2012 OpenVPN 2.1.0 x86_64-pc-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [MH] [PF_INET6] [eurephia] built on Jul 12 2010
Mon Apr 23 13:44:43 2012 IMPORTANT: OpenVPN's default port number is now 1194, based on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earlier used 5000 as the default port.
Mon Apr 23 13:44:50 2012 [server] Peer Connection Initiated with [AF_INET]
Mon Apr 23 13:44:52 2012 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Mon Apr 23 13:44:53 2012 TUN/TAP TX queue length set to 100
Mon Apr 23 13:44:53 2012 /sbin/ifconfig tun0 pointopoint mtu 1500
Mon Apr 23 13:44:53 2012 /sbin/route add -net netmask gw
Mon Apr 23 13:44:53 2012 /sbin/route add -net netmask gw
Mon Apr 23 13:44:53 2012 /sbin/route add -net netmask gw
Mon Apr 23 13:44:53 2012 Initialization Sequence Completed

There you go! By this time, you should be able to access the application you want to test 🙂 However in our case we needed to setup the IP address of the server that we are trying to gain access in our hosts file. From the terminal, we type:

[user]@exist:~$ sudo su -
[sudo] password for [user]: [input password]
root@[user]:~# vi /etc/hosts

Then input the IP address and the corresponding name of the web server we are trying to access at the end of the line.

Error mounting HDD from my Linux machine

September 7, 2011 3 comments

Encountered below error upon mounting my WD HDD in my Linux laptop:

Error mounting: mount exited with exit code 13: $MFTMirr does not match $MFT (record 0).Failed to mount ‘/dev/sdb1’: Input/output error NTFS is either inconsistent, or there is a hardware fault, or it’s a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory, (e.g. /dev/mapper/nvidia_eahaabcc1). Please see the ‘dmraid’ documentation for more details.

To fix, first install ntfsprogs utility by typing in the terminal:

sudo apt-get install ntfsprogs

Then type

sudo ntfsfix /dev/partitionName

In my case, sudo ntfsfix /dev/sdb1

To check if the fix was successful, these commands should be displayed:

exist@exist:~/Projects/ehealth/lib$ sudo ntfsfix /dev/sdb1
Mounting volume… FAILED
Attempting to correct errors…
Processing $MFT and $MFTMirr…
Reading $MFT… OK
Reading $MFTMirr… OK
Comparing $MFTMirr to $MFT… FAILED
Correcting differences in $MFTMirr record 0…OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition… OK
Going to empty the journal ($LogFile)… OK
NTFS volume version is 3.1.
NTFS partition /dev/sdb1 was processed successfully.

Whew! Now I was able to access my HDD =) Thanks to forums online!

Categories: technology, ubuntu Tags: ,

Selenium-Ruby Installations in Linux

March 30, 2011 Leave a comment

In relation to my previous post on Selenium and Ruby setup in Windows, here’s an installation guide for Linux peeps:

1. Install JRE

– In your terminal type: sudo apt-get install sun-java6-jre

– To verify type: java -version

Note: Java version should be 1.5 or higher versions

2. Install Ruby

– In your terminal, type: sudo apt-get install ruby

– To verify type: ruby –version

Note: ruby 1.8.7 works with rspec version <= 1.3.1

3. Install Rubygems

– From the terminal, type: sudo apt-get install rubygems OR you can follow this tutorial Installing RubyGems

– To verify type:  gem –version

4. Install other useful gems

  • Rake ( to create a task that runs set of tests )

– Type: sudo gem install rake

– To verify type:  rake –version

  • Selenium-client ( API to drive Selenium tests from Ruby )

– Type: sudo gem install selenium-client -v 1.2.18

– To verify type: gem list selenium-client

Note: selenium-client 1.2.18 works with rspec version 1.2.8

  • Rspec ( to define executable examples of the expected behaviour of your code )

– Type: sudo gem install rspec -v 1.2.8

– To verify type: spec –version

  • Faker ( to easily generate fake data: names, addresses, phone numbers, etc. )

– Type: sudo gem install faker

– To verify type: gem list faker

Categories: ruby, selenium, ubuntu Tags: , , ,