Pages

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Terminating running process in Linux or Unix system

Running process in Unix or Linux system sometimes are not responding or stop working for long period, to solve the problem the process need to be restarted or terminated, here are some technique to solve the problem.
First.
Open your Unix/Linux shell terminal.
Second.
Find the process id that going to be killed.
use ps or pidof to list the running process id.
ps aux | grep process_name
pidof process_name
example:
ps aux | grep lighttpd
the output from the command above
lighttpd  3486  0.0  0.1   4248  1432 ?        S    Jul31   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd  3492  0.0  0.5  13752  3936 ?        Ss   Jul31   0:00 /usr/bin/php5-cg
or using pidof
example:
pidof lighttpd
the output from the command above
3486
Third.
Use the kill command
kill PID_number
example:
kill 3486
use the -9 command option if you want to terminate instantly the  process from the id which has been defined.
killall command.
Don't use this command in Unix system, it will terminate all running process, use this command only in Linux System.
the syntax
killall -9 process_name
example
killall -9 lighttpd

Source: here

Using WvDial to connect to the internet in Ubuntu Linux


This article discusses about how to connect to the internet using  a modem wvdial intermediary software.

Tools used are:
- A handphone modem, in this article i use CDMA C700 series modem from Haier, or you can use another modem.
- Ubuntu Linux, (can also use another Linux distributions with customized setting terms).

First step, make sure your system is updated, use this command to update the system, but before all of the following step below is executed, login as root is a must.

sudo apt-get update

if the system already being update use the following command to install wvdial software

sudo apt-get install wvdial

if for some reason are not connected to the internet, wvdial can be installed offline, but first the packages mentioned below must be prepared otherwise the wvdial will refused to installed properly.

libxplc0.3.13_0.3.13-1build1_i386.deb
libwvstreams4.4-base_4.4.1-0.2ubuntu2_i386.deb
libwvstreams4.4-extras_4.4.1-0.2ubuntu2_i386.deb
libuniconf4.4_4.4.1-0.2ubuntu2_i386.deb
wvdial_1.60.1+nmu2_i386.deb

install the packages using following command.

dpkg -i (package_name)

after all packages is installed properly, cek your modem if it is detected by the system or not.

lsusb

the output from the command are.
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 05c6:9004 Qualcomm, Inc.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 125f:c03a A-DATA Technology Co., Ltd.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

watch th line Bus 004 Device 002: ID 05c6:9004 Qualcomm, Inc. This marks tell me that my modem has been detected by my Linux system with product ID = 05c6 or in hex format 0x05c6 and vendor ID = 9004 or in hex format 0x9004.
If you use another type of modem, the product id and the vendor id will be different with the example above.

next step is to use modprobe command so the modem can be detected and recognized by wvdial.

sudo modprobe usbserial vendor=0x05c6 product=0x9004

use the following command to cek if modem had been detected.

dmesg | tail

the output from the command are.
[ 27.989235] CPUFREQ: Per core ondemand sysfs interface is deprecated - up_threshold
[ 80.725304] ttyS1: LSR safety check engaged!
[ 105.329452] usbcore: registered new interface driver usbserial
[ 105.329859] USB Serial support registered for generic
[ 105.330246] usbserial_generic 3-1:1.0: generic converter detected
[ 105.332269] usb 3-1: generic converter now attached to ttyUSB0
[ 105.332298] usbserial_generic 3-1:1.1: generic converter detected
[ 105.334224] usb 3-1: generic converter now attached to ttyUSB1
[ 105.334277] usbcore: registered new interface driver usbserial_generic
[ 105.334281] usbserial: USB Serial Driver core

run the wvdial configuration.

sudo wvdialconf

the output from the command are.
Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Modem Port Scan<*1>: S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyUSB0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
WvModem<*1>: Cannot get information for serial port.
ttyUSB1<*1>: ATQ0 V1 E1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB1<*1>: Modem Identifier: ATI -- Manufacturer: QUALCOMM INCORPORATED
ttyUSB1<*1>: Speed 9600: AT -- OK
ttyUSB1<*1>: Max speed is 9600; that should be safe.
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
Found a modem on /dev/ttyUSB1.
Modem configuration written to /etc/wvdial.conf.
ttyUSB1: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

the modem had been well detected in  /dev/ttyUSB1.

next, edit the wvdial configuration.

sudo gedit /etc/wvdial.conf

the contents are.
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CRM=1
Password = smart
Phone = #777
Idle Seconds = 300
Modem Type = Analog Modem
Stupid Mode = yes
Compuserve = yes
Baud = 921600
New PPPD = yes
Modem = /dev/ttyUSB1
ISDN = 0
Username = smart
FlowControl = CRTSCTS

because now i'm using internet from SmartFren provider so the contents are like above.
if you use another provider please simply adjust the configuration using the settings from your provider.

next, dial to the provider using wvdial.

sudo wvdial

the output from the command are.
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CRM=1
AT+CRM=1
OK
--> Modem initialized.
--> Idle Seconds = 300, disabling automatic reconnect.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Tue Feb 22 18:51:09 2011
--> Pid of pppd: 16049
--> Using interface ppp0
--> pppd: 0X[16][08]
--> pppd: 0X[16][08]
--> pppd: 0X[16][08]
--> pppd: 0X[16][08]
--> pppd: 0X[16][08]
--> pppd: 0X[16][08]
--> local  IP address 10.xxx.xxx.xx
--> pppd: 0X[16][08]
--> remote IP address 10.xx.xx.xx
--> pppd: 0X[16][08]
--> primary   DNS address 10.17.3.252
--> pppd: 0X[16][08]
--> secondary DNS address 10.17.3.244
--> pppd: 0X[16][08]

cek the connection using the ping command, or simply run your browser and start browsing.

I hope this article is help to solve your problem.

How to install Firefox 8 on Fedora 14


This tutorial will discuss on how to install the Mozilla Firefox 8 through Remi and RPMFusion repos.

1. Open your Linux Shell.
2. Backup the old settings.
tar -cvzf $HOME/mozilla-firefox-profilse-backup.tar.gz $HOME/.mozilla/firefox
3. Change the user to root
su
# or #
sudo -i
4. Install the Remi repos.
Fedora
note : not necessary for Fedora 15 dan 16

# Remi dependencies on Fedora 14 #
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable-noarch.rpm

# Fedora 14 #
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm

# Fedora 13 #
rpm -Uvh http://rpms.famillecollet.com/remi-release-13.rpm

# Fedora 12 #
rpm -Uvh http://rpms.famillecollet.com/remi-release-12.rpm

CentOS, RedHat (RHEL)

# Remi dependencies on CentOS 6 and RedHat (RHEL) 6 #
rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

# CentOS 6 and RedHat (RHEL) 6
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

5. Check the newest Firefox updates.
Fedora 15/16
yum list firefox

Fedora 12/13/14, CentOS 6 and RedHat (RHEL) 6
yum --enablerepo=remi list firefox

6. Update and install firefox 8
Fedora 15/16
yum update firefox
# or #
yum install firefox

Fedora 12/13/14, CentOS 6 and RedHat (RHEL) 6
yum --enablerepo=remi update firefox
# or #
yum --enablerepo=remi install firefox

7. Run Firefox
firefox


Hopefully this article useful.

Original source can be found  here

How to set static IP address on Ubuntu Server


Linux has a myriad of beauty, such as the absence of XWindows display on Ubuntu Server, although this feature may be added later, but the absence is not a deficiency, but is one of the advantages, the absence of the visual XWindows display means more resources are available to perform as a server, because with the window-based visual display will definitely use resources, both memory and processor resources used though relatively small, it still takes a bit of space for processing.
But when he first became acquainted with Ubuntu Server, the author had a small problem when going to setup the ip address, after a few minutes of looking and searching at one's favorite search engine (the GOOGLE of course), the problem disappear in a flash. This is the answer.

1. Login as root, or simply use the sudo command.
2. Edit the interface file inside folder /etc/network/interface using your favorite editor tools.
[root@mataramkluster mcg]#gedit /etc/network/interface
3. Enter the following configuration format, for the IP address, adjust with the network condition you have.
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address xxx.xxx.xxx.xxx (enter your IP address)
netmask xxx.xxx.xxx.xxx (add wih your netmask)
gateway xxx.xxx.xxx.xxx (your gateway IP)
broadcast xxx.xxx.xxx.xxx (the broadcast IP on your network)
network xxx.xxx.xxx.xxx (enter your network IP)
network address usualy same as that used by the IP network, the difference is the last column in the address is filled with zero number.
example for the network with IP 192.168.0.1 the network is 192.168.0.0.
4. Enter prefered DNS and DNS Alternate server
[root@mataramkluster mcg]#gedit /etc/resolv.conf
nameserver xxx.xxx.xxx.xxx (filled with IP DNS1)
nameserver xxx.xxx.xxx.xxx (filled with  IP DNS2)
nameserver xxx.xxx.xxx.xxx (filled with  IP DNS3)
5. Restart the network
[root@mataramkluster mcg]#/etc/init.d/networking restart
6. Check the IP using the following command.
[root@mataramkluster mcg]#ifconfig
7. Testing the connection can be done by pinging the web server located outside your network(if your network is connected to the internet), for example pinging to www.google.co.id.
8. For another Linux distributions, the configuration maybe almost the same as in this article.


Hopefully this article is useful.

How to format a flashdisk in Fedora 14


If you are confused about how to format a pendrive in Linux, please carefully look at the following tutorial.

1 As usual, log in to your root acount using the shell, never use the ordinary user, because the process require root/superuser level.
[bagong@chsserver ~]$ su
Password: (your_root_password)
2. If you dont know where the mounted flash disk is, the device's is placed in what folder and what is vendor id number, please type the following command in the shell.

- display the flashdisk vendor and product id.
lsusb
the result from the command are.
[root@chsserver bagong]# lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 04ca:002f Lite-On Technology Corp.
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 015: ID 125f:c03a A-DATA Technology Co., Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
- showing the location of the mount point of the flash device
df -h
the result from the command are.
[root@chsserver bagong]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda7 9.7G 6.6G 2.7G 72% /
tmpfs 497M 684K 496M 1% /dev/shm
/dev/sda5 44G 26G 19G 58% /media/DATA
/dev/sdb5 246G 227G 19G 93% /media/[data_b]
/dev/sdb6 247G 65G 182G 27% /media/[data_c]
/dev/sdc1 1.9G 1.9G 3.0M 100% /media/A-DATA
/dev/sdb1 109G 27G 83G 25% /media/[data_a]
/dev/sdb7 332G 188G 144G 57% /media/[files]
here, my flashdisk named A-DATA with vendor id 0x125f and product id 0xc03a mounted by system in folder /media/A-DATA and the device is mounted in folder /dev/sdc1.

3. Unmount the flashdisk, by right clicking the flash icon and select eject or safely remove the device or if using the terminal  simply use.
umount /dev/(flashdisk_device_name)
example
umount /dev/sdc1
4. After the flashdisk is unmounted run parted application in terminal.
/sbin/parted /dev/(your_flashdisk_name)
example
/sbin/parted /dev/sdc1
the result from the command are.
[root@chsserver bagong]# /sbin/parted /dev/sdc1
GNU Parted 2.3
Using /dev/sdc1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
To view the partition table, type.
(parted) print
the result from the command are.
(parted) print
Model: Unknown (unknown)
Disk /dev/sdc1: 1053MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number  Start  End     Size    File system  Flags
1      0.00B  1053MB  1053MB  fat16
To start formatting type.
mkfs 1 fat32
it means make partition with FAT32 type partition in partition number 1

the result from the command are.
(parted) mkfs 1 fat32
WARNING: you are attempting to use /sbin/parted to operate on (mkfs) a file system.
/sbin/parted's file system manipulation code is not as robust as what you'll find in dedicated, file-system-specific packages like e2fsprogs.
We recommend you use /sbin/parted only to manipulate partition tables,
whenever possible. Support for performing most operations on most types of file systems will be removed in an upcoming release.
Warning: The existing file system will be destroyed and all data on the partition will be lost. Do you want to continue?
/sbin/parted: invalid token: 1
Yes/No? Yes
mission successfull, you have formatted your flashdisk.

Hopefully this article is helpful.

How to terminate a process in Fedora 14


Here's how to turn off a process that are running on Fedora Linux 14, to another distros or less the same, if there is a difference please adjusted.

1. Open the terminal and log in as root.
2. To view the running process use.
ps -a
this is the example of the running process.
 PID  TTY      TIME CMD
2557 pts/0    00:00:02 ping
2583 pts/1    00:00:00 su
2586 pts/1    00:00:00 bash
12342 pts/1    00:00:00 ps
3. To terminate the process with the specified PID use the following command
kill PIDname
4. Or by removing the corresponding PID inside the /var/run/ folder
rm -R /var/run/process_name.pid
example
rm -R /var/run/yum.pid
the command above will terminate the yum process.


Hopefully this article is helpful

Installing flash player in Fedora 14

After installing Fedora 14, the author usually directly perform system updates while browsing on the net (see the Fedora 14 plugin installation here), but there are problems when browsing to Youtube, no video can be played because there is no flash player plugin.
After searching from the net from my favorite search engine (the Google of course) i found the solution, here the solutions.

First download the packages here.

Open the terminal/shell, log in as root and extract the .tar file.
tar -zxvf install_flash_player_10_linux.tar.gz
Copy the libflashplayer.so to this folder
/home/nama_user_anda/.mozilla/plugins/
/usr/lib/mozilla/plugins
If you use 64bit version the file is copied here
/usr/lib64/mozilla/plugins
Restart your browser, and start your surfing.

Hopefully this article is helpful.

Disable and uninstalling AppArmor in Ubuntu Server

linux inside
This is how to disable and uninstalling apparmor in Ubuntu Server.

First, log in as root, and use the command following..

sudo /etc/init.d/apparmor stop
sudo update-rc.d -f apparmor remove
sudo aptitude remove apparmor apparmor-utils


Hopefully this article is helpful

Playing media files in Fedora 14

If you install Fedora Linux distro for sure the first time you will not be able to play media format such as .mp3 .mpeg .avi .flv and other format, it is because of the issues of the license and patent of the codecs, but the codec can be obtained from the RPMFusion repository of Fedora. This is how to do it.

1. Open the terminal/shell and log in as root.

$ su

2. Test the sound card.

$ play /usr/share/sounds/gnome/default/alert/bark.ogg

the output from the command

/usr/share/sounds/gnome/default/alerts/bark.ogg:
Encoding: Vorbis
Channels: 2 @ 16-bit
Samplerate: 48000Hz
Replaygain: off
Duration: 00:00:00.54
In:100% 00:00:00.54 [00:00:00.00] Out:26.0k [ | ] Hd:3.8 Clip:0
Done.

3. Activated rpm.livna.org, RPM fusion free and non free repositories.

$ rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
$ rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

4. Update your system.

$ yum update -y

5. Uninstall Totem and Xine, or change with Totem and Xine from RPM fusion repos

$ yum remove totem totem-mozplugin totem-plparser xine xine-lib

if the yum process is blocked because already used by another process, you can turn it of with the following command 

killall yum-updatesd

rm /var/run/yum.pid

6. Download and install the codec from RPM fusion repos

$ yum install gstreamer-plugins-bad gstreamer-plugins-bad-extras gstreamer-plugins-ugly

7. Next download your favorite player

a) Audicious

$ yum install audacious-plugins-wavpack audacious-plugins-vortex audacious-plugins-uade audacious-plugins-sid audacious-plugins-metronome audacious-plugins-jack audacious-plugins-freeworld-wma audacious-plugins-freeworld-tta audacious-plugins-freeworld-mp3 audacious-plugins-freeworld-ffaudio audacious-plugins-freeworld-alac audacious-plugins-freeworld-aac audacious-plugins-freeworld audacious-plugins-esd audacious-plugins-amidi audacious-plugins audacious-plugin-xmp audacious-plugin-fc audacious-libs audacious-devel audacious

b) mplayer

$ yum install gnome-mplayer gnome-mplayer-nautilus mplayer mplayer-doc mplayer-gui

c) xmms

$ yum install xmms-mp3 xmms-mplayer xmms2 xmms2-freeworld xmms2-mp4 xmms2-mac xmms2-mad xmms2-nonfree

d) Rhytmbox

$ yum install rhythmbox-lirc rhythmbox-upnp

e) VLC

$ yum install vlc

f) fmmpeg

$ yum install ffmpeg ffmpeg-devel ffmpeg-libs ffmpeg2dirac ffmpeg2theora

Hopefuly the article is helpful.
Similliar with here