Linux for Elastix Administrators-lab
Transcript of Linux for Elastix Administrators-lab
ELASTIX® CERTIFICATION
labs
Linux for Elastix Administrators Elastix® Certification
© 2012 PALOSANTO SOLUTIONS All rights reserved. This documentation is confidential and its intellectual property belongs to PaloSanto Solutions. Any unauthorized use, reproduction, preparation of derivative works, performance, or display of this document, or software represented by this document, without the express written permission of PaloSanto Solutions is strictly prohibited. PaloSanto Solutions, Elastix and Elastix logo design, trademarks and/or service marks belongs to MEGATELCON S.A. all other trademarks, service marks, and trade names are owned by their respective companies.
ELASTIX® CERTIFICATION
labs
Lab-2
Linux for Elastix Administrators
Laboratory 2.1
Description: In this laboratory we will learn some Linux commands so that we get the basics of how to work with this Operating System.
Objective: To familiarize with the Linux command line interface
Maximum time: 30 minutes.
Note:
Linux machines have a native capability to enter to the Elastix command line console. Windows users can access to the Elastix command through the Virtual machine command line directly, however it is better to use an SSH client.
If you are a Windows user we recommend PuTTY. You can download this software at:
http://www.putty.org/
Once you download putty you can access the Elastix server with its IP address:
Put the IP Address of your Elastix at “Host Name (or IP address)”. After that click open.
We must login as “root” user. Use the password you set at your Elastix installation.
ELASTIX® CERTIFICATION
labs
Lab-2
Once you log in, you are ready to work on the console of your Elastix.
Instructions:
This lab must be performed on a Linux command line console. Basic commands used in day-by-day Elastix management will be mentioned. All the text in blue must be written on the console for every example. When possible, a sample image will be shown to help you compare results.
Listing files and directories
- ls: list command
List the contents of the current directoryls
List the contents of the directory with additional informationls -l
List the contents of the /etc directory with additional informationls -l /etc
ELASTIX® CERTIFICATION
labs
Lab-2
List the contents of the /etc directory and show files and directories containing the word “asterisk”ls -l /etc/ | grep asterisk
Use the pwd command to see what directory you are currently inpwd
Creating directories and files
Create the directory /tmp/testmkdir /tmp/test
Enter the directory /tmp/testcd /tmp/test
From the directory /tmp/test go to the directory /tmp in absolute and relative form.cd ..
ELASTIX® CERTIFICATION
labs
Lab-2
At tmp/test create a file named test.txt. You can perform this in two ways:
1. From the actual directory (tmp) touch test/test.txt
2. Entering the directory test and creating the file
cd test thentouch test.txt
You can check if the file is listed on that directory with ls
- File edition:
Edit and save test.txt with the text editor application: vim.vim test.txt
Once in vim, press “INSERT” key (the letter “i” is also an alternative) to enable edit mode, then write your name.
To save and exit press “ESC” key and write: wq. If you want to continue working on the file and save it without exit write just w.
View the contents of test.txt (Enter the test directory first if you are not there)cat test.txt
Read the help for various commands
ELASTIX® CERTIFICATION
labs
Lab-2
man ls
To return to the console line just press q
Try it now with man yum orman scp
Creating and managing Users
At this point you should be at the directory “tmp”, go to the directoty root (/) with cd ..
Create users elx1 and elx2adduser elx1passwd ect12012
adduser elx2passwd ect22012
Login with user elx1
Use the command login
Note: This command ends the current session and starts a new one. If you are on an SSH client, your win-dow will close, and start up the client again, where you can now login with another user.
- chmod: change mode command, change the file system modes of files and directories
ELASTIX® CERTIFICATION
labs
Lab-2
Create the directory /home/elx1/private which can only be read by elx1mkdir /home/elx1/private
Make the “private” directory readable only to user elx1chmod 700 /home/elx1/private
Check /home/elx1/private directory’s owner and permissions:ls -l /home/elx1
Login as user elx2 and try to enter /home/elx1/private (You should not be able to get in). cd /home/elx1/private
Copying and Moving files
- cp: command used to copy a file; mv: command used to move a file
Login as root user again.
Copy the file test.txt in the same directory and change its name to test2.txt
To perform this action it is necessary to indicate the current location of the file and the new location of the file. If the new location is the same, it is necessary to change the name of the file; otherwise Linux will ask if you want to overwrite the file. In this example we place the file in the same directory however you can copy the file and place it on another location.
After you copy the file, execute ls –l to enlist all the files available in the directory.
cp /tmp/test/test.txt /tmp/test/test2.txtls –l /tmp/test
Note: This exercise is important to make backup of files; you will find this useful when you configure your telephony hardware on Elastix and other stuff as well.
ELASTIX® CERTIFICATION
labs
Lab-2
Move a file to another location. Create the directory /tmp/test2. Once you have created the directory, move the file “test2.txt” from the directory /tmp/test to /tmp/test2. After you move the file, ex-ecute ls –l to enlist all the files available in the directory /tmp/test2
mkdir /tmp/test2mv /tmp/test/test2.txt /tmp/test2/test2.txtls –l /tmp/test2
The command move allows you to change the name of the file in the process; you just need to write the new name on the new location.
Try moving the file “test.txt” located at /tmp/test to /tmp/test2 and changing its name to “test3.txt”
mv /tmp/test/test.txt /tmp/test2/test3.txt
Remove the file test3.txt from its current location and execute ls to confirm the deletion of the file.
rm /tmp/test2/test3.txtls –l /tmp/test2
Copy of a file from one remote location using a ssh port tunnel.
This process allows you to send a file from one location to another, basically from one server to another.
In the following example we will send the file install.log, from the IP address 192.168.1.65 to the IP Ad-dress 192.168.1.66. It is necessary to have the root password of the receiving server.
scp install.log [email protected]:/opt
ELASTIX® CERTIFICATION
labs
Lab-2
Send the file /tmp/test2/test2.txt from your server to the /tmp/test directory of another at-tendee. Remember to ask the root password.
scp /tmp/test2/test2.txt root@IP_address:/tmp/test
Note: This process has the same logic of the copy and moving of files. If you want to change the name of the file (e.g. test4.txt) then the complete sentence should be
scp /tmp/test2/test2.txt root@IP_address:/tmp/test/test4.txt
Installation of Packages
Login as root user
Install and uninstall the screen package
Installation:
yum install screen
You will be asked to confirm some actions, like download of packages, just put yes (y) and enter.
ELASTIX® CERTIFICATION
labs
Lab-2
Uninstallation:
yum remove screen
You will be asked to confirm this action, just put yes (y) and enter.
Download and install an rpm package
wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rkhunter-1.2.9-1.el5.rf.noarch.rpm
Text of link: http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rkhunter-1.2.9-1.el5.rf.noarch.rpm
ELASTIX® CERTIFICATION
labs
Lab-2
Once you complete the download proceed to install the package: rkhunter-1.2.9-1.el5.rf.noarch.rpm
rpm -ivh rkhunter-1.2.9-1.el5.rf.noarch.rpm
Uninstall an rpm package
rpm -e rkhunterrpm -q rkhunter
Network Configurations
There are several ways to configure the IP Address and network configuration on your server. We will use a graphic functionality for this course. You can also setup your network configuration at the Elastix Web Admin Interface.
Reviewing network interfaces
ifconfig –a
ELASTIX® CERTIFICATION
labs
Lab-2
In this example we can see that our network device is eth0 and the IP Address assigned.
Changing your IP Address.
setup
You will get the following window. Go to “Network configuration” and press enter – (use the arrow keys)
To setup your IP Address Go to “Edit Devices” and press enter.
We select the right device and press enter. eth0 (eth0) - (This may vary according to your hardware).
ELASTIX® CERTIFICATION
labs
Lab-2
Fill your configuration details according to your network and uncheck ‘Use DHCP’ (use the spacebar to check or uncheck). Press Ok when done.
We go one level up to configure the DNS
Here we can configure the Hostname and the DNS’s. Press Ok when done.
ELASTIX® CERTIFICATION
labs
Lab-2
Once we finish the setup, we must press “Save&Quit”
If we modified any network parameter, it is required to restart the service to apply the changes.
service network restart