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

Wednesday, December 4, 2013

Solved "-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory" on Centos 6.5 (64 bit)



Don't want to see:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

Solution:

execute
[root@CentosAshley ~]# locale
Result for english language
[root@CentosAshley ~]# locale
LANG=en_US.UTF-8
LC_CTYPE=ja_JP.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Go to the /etc/sysconfig/i18n and add
LC_ALL=en_US.UTF-8
SUPPORTED=en_US.UTF-8:en_US:en 
then on the .bashrc
export LC_TYPE=en_US.UTF-8
export LC_All=en_US.UTF-8
Don't forget to source .bashrc && reboot
then
[root@CentosAshley ~]# locale
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Monday, November 25, 2013

Configuring Network in Centos 6.4 Virtual Box with Screen Shots

This is a guide on configuring network in Centos Virtual Box with screenshots

Requirements

  1. Virtual Box 
  2. Centos 6.3 or 6.4 (I used 6.4 )

Step 1 : Configure Virtual Box Network Settings

There are different modes or ways you can configure Virtual box network settings.
  1. Not Attached
  2. NAT
  3. Bridged Adapter
  4. Internal Network
  5. Host-Only Adapter
  6. Generic Driver
  7. You can find more details about the different modes here.
I will be using the Bridged Adapter mode for this guide. It is faster as it treat the VM as an individual host within the network.
Open Virtual Box and right click on your CentOS VM, and click on “Settings“.
Go to the "Network tab" then changed the "Attached to" field to "Bridged Adapter". Choose "Name" to your network interface. Then click "ok" to save the configuration. Click "Show" to run the machine.
 

Step 2: Configure CentOS network settings

Method 1: Dynamic IP

We can configure the network by using Dynamic IP address which are assigned automatically by the DHCP server. This is the simplest way to configure your network.

NOTE: You will have a line that starts with HWADDR in the your config file, do not change or modify that line. In your terminal, type the following:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Now, add/modify the file as follows (DO NOT CHANGE the HWADDR line your config file):
DEVICE=eth0
HWADDR=08:00:27:36:3F:37
TYPE=Ethernet
UUID=1e4ee4d1-e438-4db2-9cb5-45e7a488be88
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
Now, save the file by pressing “ESC” and typing :wq and hit ENTER.
To view your network config file. type the following in the terminal:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:36:3F:37
TYPE=Ethernet
UUID=1e4ee4d1-e438-4db2-9cb5-45e7a488be88
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
Now, you will have to restart your network. You can do so by typing the following in the terminal:
service network restart
Your result must be
[root@localhost ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:
Determining IP information for eth0... done.
                                                           [  OK  ]
To view your IP address, type the following in your terminal:
ifconfig eth0
You can see your IP Address of the interface eth0 next to the field “inet addr:” as shown below:
Now, if you have internet access, then you can check if you are able to ping any website. And you should be able to get the reply. For example, in your terminal type:
 
ping google.com
 
You can press CTRL+ C to stop the ping command.
So, Hurray! you have successfully setup up your network in your CentOS Virtual Box.

Method 2: Static IP

We can also assign the network information manually by assigning the IP Address, NETMASK , GATEWAY in the network interface config file.
NOTE: You will have a line that starts with HWADDR in your config file, do not change or modify that line.

Step 1:

In you terminal, type:
vi  /etc/sysconfig/network-scripts/ifcfg-eth0
Now, edit/merge the file to the following
DEVICE=eth0
HWADDR=08:00:27:EB:C1:68
TYPE=Ethernet
UUID=38341514-767c-4546-9154-859a7b495642
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=172.16.2.105
GATEWAY=172.16.0.1
Now, press ESC and type :wq and hit ENTER to save and exit the configuration file.
cat /etc/sysconfig/network-scripts/ifcfg-eth0
 

Step 2: Change Host name: 

To change host name , you have to edit the config file /etc/sysconfig/network.
vi /etc/sysconfig/network
Now, you will see a file such as the one shown below:

To change the hostname , you can change the highlighted to any thing you want. Press ‘i‘ or INSERT to edit the file. After making necessary changes, you can save the file by pressing ESC followed by :wq and hit ENTER.
Now, restart to make necessary changes. You can reboot by typing the following in the command line:
reboot
After reboot, login and check your hostname by typing the following in the terminal / command line :
hostname
Step 3: Assign DNS Server IP

To manually assign primary and secondary DNS Server IP addresses, in your terminal type:
vi /etc/resolv.conf
Now, edit this file to the following:
; generated by /sbin/dhclient-script
nameserver 8.8.8.8
nameserver 8.8.4.4
Now, press ESC and type :wq and hit ENTER to save and exit the configuration file.
Now, if you want you can make sure you have entered and saved the correct configuration(It is a good practice to double check :D ). To view your dns config file, in your terminal type:
cat  /etc/resolv.conf

Step 4: Restart network:

Finally, all you have to do is to restart your network service. To so so, type the following in the terminal:
 service network restart
[root@centosAshley02 ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Now, you can check your Current IP configuration, by typing the following in the terminal:
Now, if you have internet access, then you can check if you are able to ping any website. And you should be able to get the reply. For example, In your terminal type:
ping imbaprogramming.blogspot.com

You can press CTRL+ C to stop the ping command.
So, Hurray! you have successfully setup up your network manually in your CentOS Virtual Box.
 
source : http://extr3metech.wordpress.com/2013/05/23/configuring-network-in-centos-6-3-virtual-box-screenshots/

Wednesday, November 13, 2013

Installing asterisk 11.4.0 to Centos 6.4 (64 bit)

1. Initial Set Up

You MUST run all of these commands as the root user!

2. Update the System

yum -y update
yum groupinstall core
yum groupinstall base

3. Install Required Dependencies

yum install gcc gcc-c++ bison mysql-devel mysql-server php php-mysql 
php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf 
caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion 
kernel-devel git subversion kernel-devel php-process sqlite-devel

4. Disabling SELINUX

sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

5. Install PearDB

You must have php with php-pear. You can refer on this link
pear install db
NOTE: You may receive a warning:
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2" At this time it is safe to ignore that message

5. Reboot Server

reboot

6. Download the Source Tarballs

wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
git clone https://github.com/spditner/asterisk-11.4.0

7. Extract the Files

tar zxvf dahdi-linux-complete*
tar zxvf libpri*
unzip asterisk*

8. Install DAHDI and libpri

NOTE: For the next set of commands it is important to follow the proper order: DAHDI first, then libpri, then Asterisk.
Install DAHDI
cd /usr/src/dahdi-linux-complete*
make && make install && make config
Install libpri.
cd /usr/src/libpri*
make && make install

9. Install the Asterisk

Change to the Asterisk directory.
cd /usr/src/asterisk*
Use this command if you are installing Asterisk on 64bit CentOS.
./configure --libdir=/usr/lib64 && make menuselect && make && make install
OPTIONAL: If you ran into errors you will want to clean the install directory before recompiling.
make clean && make distclean
Once you have an error-free install, copy the sample files from the configs subdirectory into /etc/asterisk.
make samples
Then add the Asterisk start script to the /etc/init.d/ directory
make config

10. Start and Connect to the Asterisk

Start DAHDI.
service dahdi start
Start Asterisk.
service asterisk start
Connect to the Asterisk CLI.
asterisk -rvvv
sources: http://blogs.digium.com/2012/11/05/how-to-install-asterisk-11-on-centos-6/ http://wiki.freepbx.org/display/HTGS/Installing+FreePBX+on+Centos+6.3

Tuesday, October 15, 2013

Categorize Linux Commands

I found a site that has a collection of linux commands categorize according to there use. It also included examples. Here is the link Categorize Linux Commands

Monday, September 30, 2013

SSH Login without password

Your aim

You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.

How to do it

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):
a@A:~> ssh b@B mkdir -p .ssh
b@B's password: 
Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password: 
From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B hostname B
A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:
  • Put the public key in .ssh/authorized_keys2
  • Change the permissions of .ssh to 700
  • Change the permissions of .ssh/authorized_keys2 to 640
source: http://www.linuxproblem.org/art_9.html