Profile

Click to view full profile
Hi, I'm Veerapat Sriarunrungrueang, an expert in technology field, especially full stack web development and performance testing.This is my coding diary. I usually develop and keep code snippets or some tricks, and update to this diary when I have time. Nowadays, I've been giving counsel to many well-known firms in Thailand.
view more...
Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Monday, November 28, 2011

Run internet required commands behind a proxy server in Linux

Most of the time I need to run a terminal behind a proxy server at my office to run a batch job, and I failed to run it because I don't know how to add proxy server in the terminal. But, now, I just found the command to add a proxy server in Linux. It's very simple just only one line :)

Open terminl and type this command
# Changing username, password, proxyname, and port to be yours.
export http_proxy="http://username:password@proxyname:port"
# After that you can test to run behind your proxy server
# , simply as following.
wget http://www.google.com
# If the connection is successful, then you will get the 
# file from this Google page.

To remove the proxy server from your network run the following command:
# Just delete a proxy sever variable using unset 
unset http_proxy
# Or set http_proxy to blank
export http_proxy=""

The example above is how bind a proxy server in HTTP protocol.
For the other protocols, e.g. FTP, ... so on. Try to find its variable for binding with a proxy server.
Another protocol that I know is FTP.
FTP => ftp_proxy
If you want to remove it, do the same as the example above.

Good luck ^^.

How to restart Linux network service

Sometime you may need to update your network immediately, e.g. DHCP and IP under a virtualization software, ... so on. The fastest way is to restart the network service.

You need to login as root user before using the following commands!!!

RedHat Linux command to reload or restart network:
# To restart Linux network service:
$ service network restart
or
$ /etc/init.d/network restart

# To start Linux network service:
$ service network start

# To stop Linux network service:
$ service network stop
Debian Linux command to reload or restart network:
# To restart Linux network service:
$ /etc/init.d/networking restart

# To start Linux network service:
$ /etc/init.d/networking start

# To stop Linux network service:
$ /etc/init.d/networking stop
Ubuntu Linux user use sudo command with above Debian Linux command:
# To restart Linux network service:
$ sudo /etc/init.d/networking restart

# To start Linux network service:
$ sudo /etc/init.d/networking start

# To stop Linux network service:
$ sudo /etc/init.d/networking stop

Credit: http://theos.in/desktop-linux/tip-that-matters/how-do-i-restart-linux-network-service/

Thursday, August 18, 2011

Install GUI in Ubuntu Server

When you have installed a Ubuntu Server, you can access through bash only. Since I am not familiar with that, then I will try to install gnome interface on it to make it used easier.
The easiest way to install is to use apt-get install by type "sudo apt-get install ubuntu-desktop". Then, it will download all needed packages via the internet. After installation is finished, reboot the system. Finally, you will see GUI in your Ubuntu Server.

Other resource: http://www.ubuntugeek.com/install-gui-in-ubuntu-server.html

Saturday, November 20, 2010

How to set an environment for running parallel programs(MPI) with MPICH in Linux

One of my class in this semester is Parallel Programming. Normally, I have to use cluster computer in the faculty by using remote log in, but, I don't like when I have to modify codes or create new codes, I have to upload it to the server. It's not convenience for me. So, I just find the solution to run parallel code (MPI) in one single machine that can work as the cluster with one machine.

The solution is we can use mpich2 package. The step to install is here.

Requirement:
You have to use Linux (I try with Ubuntu 10.10 and Mint 9). You may run this os through a Virtual Machine.

Step:
1. If your machine doesn't install gcc then type : "sudo apt-get install gcc"
2. Then you install mpich2 by using this command : "sudo apt-get install mpich2"
3. After you install come to your home folder e.g. /home/[your username] by : "cd $HOME"
4. Then you go to that directory and create the file name ".mpd.conf" and the content is "MPD_SECRETWORD=mr45-j9z"
5. type "chmod 600 .mpd.conf"
6. The directory that want to run code have to create the file name "mpd.hosts" which content is "localhost"
7. Finish configuration.

Test:
1. You have to boot mpd by "mpdboot -n 1"
2. Your machine Must be connected to the access point.
3. Compile program by "mpicc -o x x.c" ; where x is your code file name .
4. Run the code by "mpirun -np y ./x" ; where y is process number and x is object code name.

Now, You can run MPI code in your machine.
More Information: https://help.ubuntu.com/community/MpichCluster

Friday, October 22, 2010

Quick open teminal in Ubuntu by using one click

From the last entry, Windows can open command window at the current path in one click. Also, Ubuntu can do that too. The solution is here.
1. Open terminal.
2. Type "sudo apt-get install nautilus-open-terminal"
3. Restart your machine.
4. After that, when you right click at that directory, it will show tab for openning terminal.
5. Click at that tab, the terminal will be shown at the current directory you click.
p.s. Linux Mint can do that without any installation.
For Windows: http://darkkung-blog.blogspot.com/2010/10/open-command-window-at-current-path-in.html
For Mac: http://darkkung-blog.blogspot.com/2011/02/quick-open-terminal-in-mac-by-using-one.html