Women at work

I have a PhD in electrical engineering and have been teaching and doing programming and IT for ... too many years. (specializing in networks and security) I am not going to disclose my age! I am one of very few women of my age who STAYED in the field, since it is super competitive macho field. But here I am! I use my engineering skills for everything I do. In this blog, I will share anything from technical to social comments on technology.

Tuesday, May 30, 2017

Configure your Unix first....



CONFIGURE UNIX 

Some commands require root privileges.
Root prompt is marked with #.
“Regular” user prompt is marked with >

1.    If your Unix server is on Internet, you can access it remotely by using putty. Some organizations require to open a virtual desktop on organization network, then use putty. Open putty and go to address assigned to you. You can login only as yourself. The root password is given to you in class.
If your Unix server is NOT on Internet, then you have to physically access it and many of the choices outlined below will not work until you manually put the appropriate files onto your server. Good luck.

2.    In a text editor of your choice, add entries to your /etc/hosts file. You have to do this as root.

If you have only command-line interface, use nano or vi. In GUI, there is Open Office, etc.
prompt# nano /etc/hosts
Add the following entries at the bottom of the file:
IPaddressOfFirstServer server1
Etc.

Now you can simply use those “English” names instead of the IP addresses.

3.    Open another terminal (in remote case, login again using putty) and LOG IN AS YOURSELF. AVOID AT ALL COSTS LOGING IN AS ROOT. Well managed servers do not allow logging as root.

Open another terminal under your name (so now you have two opened.) You can use one for running man and info commands to figure out how to do things, and one for actually doing the work.

If you need root privileges to run a command, just append the word “sudo” at the front of the command. For example, if Unix complains that you can’t edit /etc/hosts file without superuser privileges, then just run it like this:

  prompt> sudo vi /etc/hosts


4.    Customize your terminal by clicking on the top portion of the window. Set the font and color to what you want.

UnixPrompt> uname –a
UnixPrompt> cat /etc/os-release




1        Installing software


There are many repositories of software:  

          CentOS.    

        Fedora22.   

Your computer should be configured to automatically go to the basic ones.




Let’s start slow:

Software can be downloaded in several flavors: .tar.gz file, .rpm file, etc.



1.1    CHOICE #1: use yum  or apt or dnf or zypper


Package managers are a great blessing because they find and install all dependencies automatically. Until you start installing without them, you are likely not even close to fully appreciating how helpful this is.
            Each software depends on certain libraries. Let’s assume that you want to install software XYZ and it requires library library99 version 3. If there is already software installed on your system that also depends on library99, it will have to be updated too. Buit

These package managers work on specific Linuxes:

yum:               Redhat, CentOS
d          nf:       Fedora22                               Fedora is technically redhat family, but….

apt:                  Ubuntu
zypper:           OpenSuSE

They all have similar syntax. For example:

        prompt> yum install softwarename


The beauty of yum is that it doesn’t require even specifying the exact name. It will find the most recent package and install all dependencies.

If yum can’t find it, then try telling it to look with a wider scope (* stands for a wildcard):

        prompt> yum install softwarename*




1.2    CHOICE #2: use rpm installer (on RH family)


.rpm files are finicky but unfortunately used often.

Also, you have to find the rpm for exactly your platform. Good luck.

The main problem with rpm files is that YOU have to install all dependencies first, before you install the software you want. Installing some libraries may mess up the software already installed on your computer. Good luck.


To see if your software, e.g. nmap, is already installed on Unix:
            prompt> rpm –q nmap

If the software is not installed, you will have to get the .rpm file from somewhere, e.g. some rpm depository on the web.
On the RPM depository, such as RPMfind, there are many versions of the same software, so you will have to download the one specifically for your computer.
UnixPrompt> uname –a
UnixPrompt> cat /etc/os-release        OR   cat /etc/issue.net  OR   cat   /etc/issue    OR   lsb_release –a     OR  cat /etc/*-release     OR   cat /etc/debian-version
Download the rpm file that works on your platform.
Then try out to install the software using rpm command.

If you are lucky, rpm command can install directly off the download web site:

prompt# rpm -vhU    http://..... /file.rpm

If that won’t work, then you have to install it manually. First, download the file. Then, install it:
            prompt# rpm  –i   file.rpm 
 (of course, first you have to download the .rpm file)

            Use wget or ftp to download the files:
·         download the file to your Windows computer and then transfer over using Filezila or another secure ftp program.
·         download the file directly to your Unix computer
o   wget http://...file.rpm

YOU HAVE TO DOWNLOAD ALL DEPENDENCIES. RPM DOESN’T DO THAT AUTOMATICALLY.  Have fun...




1.3    CHOICE #3: installing from the source


When nothing else works, it is time to compile from the source. Good luck!

.tar.gz file is used for downloading source code that needs to be compiled. The slang name is “tarball.” Tarball contains plain code that will have to be compiled on your platform.

You will have to get the  tarball file from somewhere, usually some custom web site, very seldom a repository.
On that site, there should be only one tarball, but you will have to compile it specifically for your computer.
To find out which platform and OS you are using, do:
UnixPrompt> uname –a
UnixPrompt> cat /etc/os-release

First, unpack the tarball:

prompt# gunzip file.tar.gz  
prompt# tar xvf file.tar

On Linux systems, you can mush the above two commands into one:
        prompt# tar xzvf file.tar.gz

In case that you downloaded .tar.b2z file, use tar xjvf.


Tarball contains plain code. Follow the instructions for compiling it. Read the INSTALL file (or README file, or whatever filename indicates the instructions are there).

Very often, but not always! the sequence is:

prompt# ./configure
prompt#  make
prompt#  make install

make is a command that you will have to install first.

If running a command requires root privileges, you can either run the command starting with: sudo  , e.g.
            Unixprompt> sudo  dosomethingthatrequiresprivilege
Or you can log in as the root user:
            Unixprompt>  su   -

1.4    Make yum More Powerful: make it look inside rpmforge repository

Many softwares cannot be installed by plain yum, since it looks into a limited number of repositories.
To enable yum to look into rpmforge repository, you need to add it to yum’s “path.” http://ithelpblog.com/os/linux/redhat/centos-redhat/install-rpmforge-on-centos-6-3/

Other Linuxes have their own “special” repos.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home