LINUX Installation, setup, and maintenance help.

 

General information

    Editing Files

    Looking at files

    File Permissions

    General Commands

Configure Startup

Installing

    Network

        IP address

        DNS

        Outside sources

        Setup SSH

        Network Services

    Finding installed Components

    Adding Components

    Upgrading Components

    Removing Components

    Creating Links

Local Services

Remote Services

Setup and Configure Users

Browsing

Xwindows

Compatibility with Windows

Setup Apache

Setup Exim

Setup PHP

Setup MySql

Troubleshooting

Other Questions


 

A Stepwise to installing Debian - Linux Server

A Stepwise to installing apache - Web Server

A Stepwise to installing Exim - Email Server

A Stepwise to installing PHP - Web Scripting

A Stepwise to installing MySql - Database

A Stepwise to installing FrontPage Extensions - Apache addon

 


 

General Information

        two kinds of files.

1. dynamic as soon as you write the file all change take effect.

    example is your host table /etc/hosts

2. static files - these are files that can be modified and changes

will not take effect until a process is stopped and restarted.

    example is the /etc/exim/exim.conf file

 

Editing File

        # in vi you can do anything

        # try :set ruler (that is colon set ruler return)

        # check out the bottom of the screen in the middle.

        # to turn off use

        # :set noruler

Looking at files

# Up arrow will retrieve last input command

       you can also edit the command with the side arrow key, and the backspace key. i believe the default is last 100 commands in the        mem.

# cat <filename>

# cat it typically used to concatinate files together so it just

# dumps content to STDOUT (your terminal)

# more <filename>

# more is user friendly shows a page at a time and pauses in

between.

# less <filename>

# less is the linux claim to fame for the coined phrase "less is

more"

# b/c less does what more does but it lets you look back at

previous pages

# and other useful things.

# man less will give good info.

# use "q" to quit out of less, more.

# Try cat, use more and then check out less and you will agee

that

# less IS more.

#

# use grep to get lines that match a pattern or don't for that

matter.

# example

# grep <string> <filename>

glen@goliath:/etc$ grep dale /etc/aliases

ruth: dale, chris

joshua: dale, chris

hannah: dale, chris

noah: dale, chris

allkids: cynthia, joey, glen, amanda, dale,

sold: glen, dale

router: glen, dale

itboys: paul, dale, glen, grant

allit: paul, dale, glen, grant

dale, paul, grant, glen, joey

genxboys: dale, paul, grant, glen, joey

dale, paul, grant, glen, cindy, ewart

dale, paul, grant, glen, cindy, ewart

dale, paul, glen, newkirk, ewart

#

# man grep and get good info this is a usful tool

 

two good commands for finding stuff

# locate <filename>

ie

# locate httpd.conf

the find command

# find <start in this directory> -name <the name of the file you are looking for> ie # find /etc -name httpd.conf if you want to use the wild card in find you have to escape it (preceed wildcard) with a \ otherwise it will look for the literal charactor "*" ie # find / -name httpd\*

 

            <Shell> -x <script name> will execute script and display activity

              ie - /bin/sh -x fp_install.sh will run fp install, and echo each line as it is run through

              foo is the name of a temp file

              > foo will direct the output to foo and overright it

              >> foo will direct the output to foo and append to it

File Permissions     

      How do I add users, add groups, and change permissions on files and

      # This is a loaded question.

      # there are a few ways to add users and groups for now i will just tell you

      # the automated way, but do understand that this can be done manually.

      # to add users use:

      # adduser

      # for groups...you guessed it

      # addgroup

      # it is actually the same script check out the manpages

      # man adduser

       

      OWNERSHIP

      # this is huge

      2 comands you need

      chown - change file owner and group

      chmod - change file access permissions

      # owner and groups is an easy one.

      # execute ls -la (that is ls space minus la)

      # the third column is the owner and the 4th is the group

      # use:

      # chown <owner>:<group> <filename>

      # yes that is a colon between owner and group, no space.

      # i think it is obveous that you have to be the owner or root

      # to modify these perms

      example:glen@goliath:~$ ls -la foo

      -rw-r--r--    1 glen     glen            0 May 21 14:33 foo

      glen@goliath:~$ su

      Password:

      root@goliath:/home/hodgins/glen# chown dale:backup foo

      root@goliath:/home/hodgins/glen# ls -la foo

      -rw-r--r--    1 dale     backup          0 May 21 14:33 foo

     

      PERMISIONS

      # the first column of  "ls -la" is the permision column

      # there are 10 potential slots

      # if slot1is a - this means it is a file

      # slot1 is "d" then this is a directory

      # last nine slots are ownership for:

      # slot 2,3,4 owner pems

      # slot 5,6,7 group perms

      # slot 8,9,10 world perms

      # the three slots for each refer to read write and execute.

      # changing them is where it gets a little tricky

      # think of it like this rEAD=4    wRITE=2    ExECUTE=1

      # now just add them together to get the desired permission and use chmod

      # in the following example i will make the file foo  rwx for the owner (dale)

      # rx for the group "backup" and read (r) for the world, so if i add these

      # up i need to use 754

      root@goliath:/home/hodgins/glen# chmod 754 foo

      root@goliath:/home/hodgins/glen# ls -la foo

      -rwxr-xr--    1 dale     backup          0 May 21 14:33 foo

      root@goliath:/home/hodgins/glen#

     

General Commands

ls - list

            # these will be links so execute ls -la this will show where the actual file is

cp <from> <to> - copy

mv <from> <to> - move

dmesg - hardware Probe

cat <file> - show file

more <file> - show file a page at a time

less <file> - interactive version of more ie: use /<string> to search.

   this is where the linux expression "less is more" comes from.

look for stuff -

find <start dir> -name <what you are looking for>

example below = find starting in the root dir all files named go

# find / -name exim

            <control>C stop command from running

            <Tab> will auto complete to the next duplicated character

            # cd ../ (that is cd space dot dot slash) - backup one directory

 

Configure Startup

        Reconfigure startup jobs/programs

            all startup scripts live in /etc/rc2.d, and /etc/rc3.d

            most have soft links to /etc/init.d/

            /etc/rc3.d and move the startup file from Sname to sname

                the capital S in the beginning of the script dicates the script is to run at startup

Installing

    Network

          Set IP address and place on network

all network info is in /etc/network/interfaces file and this is a Dynamic file. 

it is a good idea to back up a file b4 you edit. just make a copy.

# cd /etc/network

# cp interfaces interfaces.bak

 

            Setup Machine name            

               # the package is samba. config is pretty simple

                # man samba and check out samba.org

                there a way to change that to be the same as an existing domain?

                # yes, then all you would be doing is adding the machine to your

                domain.

                # again the samba config file is were this is done.

                # typical install the file path is: /etc/samba/smb.conf

                I see nothing in the rcX.d files they are all empty (or so it

                seams)

                # execute ls -la

                # this will show you if they are links to other files.

 

Setup DNS

ndlookup or dig is the tool for looking up and checking DNS configuration

DNS uses has 3 files

-/etc/resolv.conf

    example follows:

        root@goliath:/etc# more resolv.conf

        search hodgins.org

        nameserver 66.255.30.90

        nameserver 66.255.30.93

-/etc/nsswitch.conf

    default should be OK.

-/etc/hosts

    Setup all hosts that need to be resolved

Setup Outside sources

    Login as <username>   

    Become superuser (just type su) ß same passwd as <root>

    cd to /etc/apt

    add the following three lines to the file /etc/apt/sources.list

        deb http://security.debian.org/ stable/updates main

        deb http://http.us.debian.org/debian stable main contrib non-free

        deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free

    comment out all other lines with a # sign at the beginning of the line.

    Save and quit the file

    Do the following at the prompt.

    # apt-get update

    # apt-get upgrade

 

    This will point your package source list to the net

    And load all security updates on the machine.

    We will automate this later

            Setup SSH

            Network Services         

                    To turn on telnet

                        # load the binary

                        # apt-get install telnet

    Finding installed Components

                1. use the web www.debain.org

                2. check the package files.

                    there are 3 distributions stable, un-stable, testing http://www.debian.org/distrib/packages

                    each distribution will load with 3 files they include the following:

                - /var/lib/apt/lists/http.us.debian.org_debian_dists_stable_contrib_binary-i386_Packages

                - /var/lib/apt/lists/http.us.debian.org_debian_dists_stable_main_binary-i386_Packages

                - /var/lib/apt/lists/http.us.debian.org_debian_dists_stable_non-free_binary-i386_Packages

                Notice the difference: contrib, main, non-free

            To know what packages need upgrading.

              # apt-get knows.

              # www.debian.org search on packages.

                # the command for linux is dpkg -l

                # to check for a specific package use grep ie:

                glen@goliath:~$ dpkg -l | grep mysql

                ii libdbd-mysql-p 1.2216-2 mySQL database interface for Perl

                ii libmysqlclient 3.23.49-8.2 mysql database client library

                ii mysql-client 3.23.49-8.2 mysql database client binaries

                ii mysql-common 3.23.49-8.2 mysql database common files (e.g. /etc/mysql

                ii mysql-server 3.23.49-8.2 mysql database server binaries

                ii php4-mysql 4.1.2-6 MySQL module for php4

                glen@goliath:~$

    Adding Components

            Install new or updates pieces.

              # for all updates use apt-get install <package>

            Telnet              

                # load the binary

                # apt-get install telnet

            FTP

                # FTP not too secure i would use ssh

       

                  (What process do I need to run) FTP and telnet work as clients, but not servers.

                  # there are a few packages for ftp:

                  root@goliath:~# grep "Package: ftp" main

                  Package: ftp

                  Package: ftp-proxy

                  Package: ftp-ssl

                  Package: ftp-upload

                  Package: ftp-utils

                  Package: ftpd

                  Package: ftpd-ssl

                  Package: ftpfs-src

                  Package: ftpfs-utils

                  Package: ftpgrab

                  Package: ftplib-dev

                  Package: ftplib3

                  Package: ftpmirror

                  Package: ftpwatch

    Upgrading Components

            To upgrade individual packages

              # apt-get update

              # apt-get install <pkage>

              # man apt-get good info.

    Removing Components   

    Creating file links

             The first thing that you want to do is create links to these file so that you do not

            have always remember where they are.

            1. go to your home dir as root

            2. create a soft link

            3. vi, cat, grep, more, less the link you just created in your home dir.

            example follows.

            root@goliath:~# cd

            root@goliath:~# pwd

            /root

            root@goliath:~# ln -s /var/lib/apt/lists/http.us.debian.org_debian_dists_stable_main_binary-i386_Packages main root@goliath:~# ls -la main

            lrwxrwxrwx 1 root root 83 May 16 15:55 main -> /var/lib/apt/lists/http.us.debian.org_debian_dists_stable_main_binary-i386_Packages

            root@goliath:~# grep "Package: mysql" main

            Package: mysql-client

            Package: mysql-common

            Package: mysql-navigator

            Package: mysql-server

            Package: mysqltcl

            root@goliath:~#

Local Services

            most services have startup scripts in the /etc/rc3.d dir.

            you can execute <script> start or <stop> stop.

            ie:

            /etc/rc3.d/apache-ssl stop

            or

            /etc/rc3.d/apache-ssl start

            to check of somethig is runing chech the process table.

            ps -ef | grep <something>

            for apache execute:

            ps -ef | grep apache

            To Start and Stop services          

                # the machine must know where you are.

                # if you are in the directory use

                # ./apache stop (that is dot slash file space stop)

                # you can always use full path

                # /etc/init.d/apache stop

                        debian:~# ps -ef | grep apache

                        root 8568 1 0 May18 ? 00:00:00 /usr/sbin/apache

                        www-data 9125 8568 0 06:25 ? 00:00:00 /usr/sbin/apache

                        www-data 9126 8568 0 06:25 ? 00:00:00 /usr/sbin/apache

                        www-data 9127 8568 0 06:25 ? 00:00:00 /usr/sbin/apache

                        www-data 9128 8568 0 06:25 ? 00:00:00 /usr/sbin/apache

                        www-data 9129 8568 0 06:25 ? 00:00:00 /usr/sbin/apache

                        root 9342 9315 0 09:41 pts/0 00:00:00 grep apache

                        so is it stopped? I would think it is still running.

                        # always trust the ps table

                        # you are correct it is still running.

Remote Services

        A - Get putty - http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

        B - use ssh to  <your IP address>

login as yourself.

On the Linux machine-

        C - run keygen to  create a new password for you.

        D - At the prompt create run ssh-key-gen.

    <username>@<machine name>: ssh-keygen –t rsa

    follow the prompts and give a passcode that is secure.

        this will also create a file by default in /root/.ssh/.id_rsa

        E - create a /todo file that has a list of the things to

Setup and Configure Users

 

Browsing

        To open a browser, and navigate the new (can I do this with a mouse)

              # mouse needs X

              # use lynx http://www.hodgins.org

              # man lynx <-- good info.

              lynx <URL> will download if it is directed to a file

              Wger <URL> will download if it is directed to a file

Xwindows

              # mouse needs X

 

Compatibility with Windows

               

      How do I set the system up to browse it from Windows?  Can I share the

      entire drive for display, or only directories? 

      # all are possible samba is the tool

      # it is probably running already

      # check out /etc/samba/smb.conf

       

      How do I set permissions

      on that share?

      # in the /etc/samba/smb.conf      file

     

    Can I set it up so that I can use Windows domain permissions on Linux?

      (I may have already asked this one)

    # This is a good one. if you open a share i believe that windows can control the

      # permissions on files in that dir but otherwise i think not?

 

Setup Apache

            Apache

load apache and configure ref: www.apache.org

                What is the difference between a sub web, and a virtual host? 

                  # good explanation of sub-web

                  # http://www.cyfi.com/support/websupport/organizing/create_subweb.htm

                  # a virtual host is set up to create a shorter link to a deep page.

                  # or a page that you want to keep outside the scope of the web pages ie: /var/wwwpub/

                  # for example i have set up

                  # https://mail.hodgins.org as a website for users to get mail.

                  # This makes getting there easy. (yes this works if you have an account

                  # you can send and receive mail. Try it.) squirrelmail it written totally in php.

                  # i just added the following lines to my httpd.conf file

                  #-----hodgins.org-----Secure--------

                  <VirtualHost mail.hodgins.org:443>

                  SSLEnable

                  Port 443

                  DocumentRoot /usr/share/squirrelmail/

                  TransferLog /var/log/apache-ssl/access.log

                  ErrorLog /var/log/apache-ssl/error.log

                  </VirtualHost>

                  # you will notice that the web pages actually reside in /usr/share/squirrelmail

       

      How are

      the two distinguished in the browser?

      # the browser does not care, it just need a valid link.

      # it is the config file that is essentially facking out the browser.

       

      (I think I can figure it out from there)

Setup Exim

            Exim

install exim (mail) and configure ref:www.exim.org

            Apt-install Exim
 

Setup PHP

 

        phpfetch - will recall a web page with original programming

Setup MySql

 

Troubleshooting

    xwindows

        How do I troubleshoot xwindows

              # as you run startup script ( ./S99script) errors should show.

 


A Stepwise to installing Debian

        1. load all desired programs off the CD

        2. Setup IP Address

        3. Setup DNS

        4. Setup Source Files

        5. Update all file

        6. Setup file links

        7. Setup SSH

        8. Setup Remote Access

A Stepwise to installing apache

        1. Install Apache

        2. Configure Apache

            configuration file name  = /etc/apache/httpd.conf

                Example - httpd.conf

A Stepwise to installing Exim

        1. Install Exim

A Stepwise to installing PHP

        1. Install PHP

A Stepwise to installing MySql

        1. Install My Sql

            # use apt-get install mysql

A Stepwise to installing FrontPage Extensions

        1. download the extensions from microsoft

        2. Do the following:  Installing Extensions               

                Helpful information to know as you install and accept the defaults.

                        there is an error in the fp_install.sh file -

                            you need to edit the file with vi, and change line xxxx from cp -p <filename> to cp -r -p <filename>

                            or it will fail on copying the /etc/apache directory to /etc/apache.orig

                        apache configuration file name  = /etc/apache/httpd.conf

                                If you have not made any changes to users

                                    Administrator = root  Password =  <what you defined at system setup>

                                    Virtual Hosts are...

                                    Sub Webs are...

                        If you need to reinstall the extensions you will need to delete the frontpage directory from /var/local/frontpage

 

Other General Questions

       

      Is there a particular method I need to use to implement a new sub web or

      virtual host? 

      # sub-webs are FP

      # for virtual hosts edit the httpd.conf  file