Important built-in information in Debian Wheezy 7 system.

Important built-in information in Debian Wheezy 7 system.

  • Our purpose is how we can grab important information available in our system.
    We can guide us trough many available built-in tools. It’s impossible to remember all commands and what functions they have.
    The system give us the opportunity to rediscover forgotten things.
    When you’ve a question you can use the whatis command, the answer will be displayed.
    Lets see what’s happen if you execute the command without any option.

    The system will ask you what you want to know.
    Type whatis + enter.

anne@alfa:~$ whatis
whatis what?
anne@alfa:~$

  • Retype your whatis command + option you willing to know about.
    Example 1: Type whatis + uptime + enter.

anne@alfa:~$ whatis uptime
uptime (1)           – Tell how long the system has been running.
anne@alfa:~$

  • Example 2: Type whatis + date + enter.

anne@alfa:~$ whatis date
date (1)             – print or set the system date and time
anne@alfa:~$

  • If you dont know what a command stands for you can use the same whatis command + name programm or syntax.
    Let’s use the ls as option.
    Type whatis + ls +enter.

anne@alfa:~$ whatis ls
ls (1)               – list directory contents
anne@alfa:~$

  • Let’s ask what the dir represents.
    Type whatis + dir + enter.

anne@alfa:~$ whatis dir
dir (1)              – list directory contents
anne@alfa:~$

  • The whatis command is useful but sometimes we want to know more about the syntax. We can execute the specified command + –help.
    Example 1: Type ls –help + enter.
    (below a incomplete help page displayed)

anne@alfa:~$ ls –help
Usage: ls [OPTION]… [FILE]…
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor –sort is specified.

Mandatory arguments to long options are mandatory for short options too.
-a, –all                  do not ignore entries starting with .
-A, –almost-all           do not list implied . and ..
–author               with -l, print the author of each file
-b, –escape               print C-style escapes for nongraphic characters
–block-size=SIZE      scale sizes by SIZE before printing them.  E.g.,
`–block-size=M’ prints sizes in units of
1,048,576 bytes.  See SIZE format below.

  • We can consult man pages in our terminal. Man pages describe how to use syntax combinations.
    This can be overwhelming when you open a man page.
    Use the ls option in this example.
    Type man ls + enter.
    (below a incomplete man page displayed)
    Press q to leave man page!

anne@alfa:~$ man ls
SYNOPSIS
ls [OPTION]… [FILE]…

DESCRIPTION
List information about the FILEs (the current directory by default).  Sort entries alphabeti‐
cally if none of -cftuvSUX nor –sort is specified.

Mandatory arguments to long options are mandatory for short options too.

-a, –all
do not ignore entries starting with .

-A, –almost-all
do not list implied . and ..

–author
with -l, print the author of each file

-b, –escape
print C-style escapes for nongraphic characters

  • The man pages can be very difficult to read so we can use another tool info.
    Sometimes you have a better description which the info command. Some info pages are quite hard to read as well like man pages do. The best way is to try the differences between them and search the best suitable.
    Let’s guide us trough a info page about man.
    Type info man + enter.
    (below a incomplete info page displayed)
    Press q to exit info list!

anne@alfa:~$ info man
MAN(1)                        Manual pager utils                        MAN(1)

NAME
man – an interface to the on-line reference manuals

SYNOPSIS
man  [-C  file]  [-d]  [-D]  [–warnings[=warnings]]  [-R encoding] [-L
locale] [-m system[,…]] [-M path] [-S list]  [-e  extension]  [-i|-I]
[–regex|–wildcard]   [–names-only]  [-a]  [-u]  [–no-subpages]  [-P
pager] [-r prompt] [-7] [-E encoding] [–no-hyphenation] [–no-justifi‐
cation]  [-p  string]  [-t]  [-T[device]]  [-H[browser]] [-X[dpi]] [-Z]
[[section] page …] …
man -k [apropos options] regexp …
man -K [-w|-W] [-S list] [-i|-I] [–regex] [section] term …
man -f [whatis options] page …
man -l [-C file] [-d] [-D] [–warnings[=warnings]]  [-R  encoding]  [-L
locale]  [-P  pager]  [-r  prompt]  [-7] [-E encoding] [-p string] [-t]
[-T[device]] [-H[browser]] [-X[dpi]] [-Z] file …
man -w|-W [-C file] [-d] [-D] page …
man -c [-C file] [-d] [-D] page …
man [-hV]

DESCRIPTION
man is the system’s manual pager. Each page argument given  to  man  is
normally  the  name of a program, utility or function.  The manual page
associated with each of these arguments is then found and displayed.

  • We can use another feature named apropos. This act as a search engine for man pages and descriptions.
    Here you’ll find a long alphabetic list.
    First we have performed the command whatis apropos to verify it’s meaning. Let’s use the option ls.
    Type apropos + ls + enter.
    (below a incomplete aprops list displayed)

anne@alfa:~$ whatis apropos
apropos (1)          – search the manual page names and descriptions

anne@alfa:~$ apropos ls
alsamixer (1)        – soundcard mixer for ALSA soundcard driver, with ncurses interface
amidi (1)            – read from and write to ALSA RawMIDI ports
amixer (1)           – command-line mixer for ALSA soundcard driver
aplay (1)            – command-line sound recorder and player for ALSA soundcard driver
arecord (1)          – command-line sound recorder and player for ALSA soundcard driver
aseqdump (1)         – show the events received at an ALSA sequencer port
aseqnet (1)          – ALSA sequencer connectors over network
assert (3)           – abort the program if assertion is false
auth_destroy (3)     – library routines for remote procedure calls
authnone_create (3)  – library routines for remote procedure calls
authunix_create (3)  – library routines for remote procedure calls
authunix_create_default (3) – library routines for remote procedure calls
backtrace_symbols (3) – support for application self-debugging
backtrace_symbols_fd (3) – support for application self-debugging
blockdev (8)         – call block device ioctls from the command line

  • Some command has more than one man page available.
    In this example we’ll use the uname option. Here are two man pages available.
    Type man -f uname.

anne@alfa:~$ man -f uname
uname (1)            – print system information
uname (2)            – get name and information about current kernel
anne@alfa:~$

  • We know there are two uname man pages available. Let’s discover man page 2. Section 1 will be displayed as default when you execute man uname.
    You must insert the section between man and the option you like. In this example we’ll use  (command) man + (section) 2 + (option) uname.
    (below a incomplete uname (2) man page displayed)
    Press q to leave man page.
    Type man + 2 + uname + enter.

anne@alfa:~$ man 2 uname
UNAME(2)                            Linux Programmer’s Manual                            UNAME(2)

NAME
uname – get name and information about current kernel

SYNOPSIS
#include <sys/utsname.h>

int uname(struct utsname *buf);

DESCRIPTION
uname() returns system information in the structure pointed to by buf.  The utsname struct
is defined in <sys/utsname.h>:

struct utsname {
char sysname[];    /* Operating system name (e.g., “Linux”) */
char nodename[];   /* Name within “some implementation-defined
network” */
char release[];    /* Operating system release (e.g., “2.6.28”) */
char version[];    /* Operating system version */
char machine[];    /* Hardware identifier */
#ifdef _GNU_SOURCE
char domainname[]; /* NIS or YP domain name */
#endif
};

  • Try another option traceroute. In this example you’ll have two man pages available.
    Type man -f traceroute

anne@alfa:~$ man -f traceroute
tcptraceroute (8)    – print the route packets trace to network host
traceroute (1)       – print the route packets trace to network host
anne@alfa:~$

  • Now we’re able to search help items we’ll discover important information.
    Very useful for system administrators and people who’re interested how the system looks like.
    Let’s start the simple way to get used to it.
    Let’s show the date.

    Type date + enter.

anne@alfa:~$ date
Sat Oct 26 20:21:50 CEST 2013
anne@alfa:~$

  • If you preference the calendar format use the cal command.
    Type cal + enter.

anne@alfa:~$ cal
October 2013
Su Mo Tu We Th Fr Sa
1  2  3  4  5
6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

anne@alfa:~$

  • How long is our system running? Use command uptime.
    This command is measured at 20:47:49  and you can see our system is running about 2:51 hours.
    Notice 2 users are logged, one user is myself and the other one is the root user on the background.
    Type Uptime + enter.

anne@alfa:~$ uptime
20:47:49 up  2:51,  2 users,  load average: 0.00, 0.03, 0.05
anne@alfa:~$

  • I’m interested in the login history off all users. This can be useful by system administrators to see what happens by users.
    To reveal interested information about last  you can view the last info page.
    Let’s look who has logged into the system by using the command last.
    Type last + enter.

anne@alfa:~$ last
anne         pts/0                :0.0                           Wed Oct 30 12:04   still logged in
anne         tty7                  :0                               Wed Oct 30 12:04   still logged in
(unknown tty7                :0                              Wed Oct 30 12:04 – 12:04  (00:00)
reboot   system boot  3.2.0-4-amd64       Wed Oct 30 12:04 – 14:25  (02:20)
anne        pts/0                :0.0                           Tue Oct 29 23:27 – 01:02  (01:35)
root         pts/1                :0.0                           Tue Oct 29 23:18 – 23:19  (00:01)
anne        pts/0                :0.0                           Tue Oct 29 23:15 – 23:17  (00:01)
anne        pts/0                :0.0                           Tue Oct 29 14:56 – 19:22  (04:26)
anne        tty7                   :0                              Tue Oct 29 14:41 – 01:05  (10:23)
(unknown tty7                :0                              Tue Oct 29 14:40 – 14:41  (00:01)

  • Let’s take a look at het system properties. We can use the uname command.
    What’s uname? Execute whatis command and let’s find out  what the uname commmand does.
    Type uname + enter.

anne@alfa:~$ whatis uname
uname (1)            – print system information
uname (2)            – get name and information about current kernel
anne@alfa:~$ uname
Linux
anne@alfa:~$

  • View uname help page to reveal more options.
    Type uname –help + enter.

anne@alfa:~$ uname –help
Usage: uname [OPTION]…
Print certain system information.  With no OPTION, same as -s.

-a, –all                print all information, in the following order,
except omit -p and -i if unknown:
-s, –kernel-name        print the kernel name
-n, –nodename           print the network node hostname
-r, –kernel-release     print the kernel release
-v, –kernel-version     print the kernel version
-m, –machine              print the machine hardware name
-p, –processor            print the processor type or “unknown”
-i, –hardware-platform  print the hardware platform or “unknown”
-o, –operating-system   print the operating system
–help     display this help and exit
–version  output version information and exit

Report uname bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/&gt;
General help using GNU software: <http://www.gnu.org/gethelp/&gt;
For complete documentation, run: info coreutils ‘uname invocation’
anne@alfa:~$

  • We have a lot of options available so let’s try it and see which information will appears.
    In my opinion you can get the best information while using the -a option.
    Below a example with all options used.
    Type uname + option + enter.

anne@alfa:~$ uname -a
Linux alfa 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
anne@alfa:~$ uname -s
Linux
anne@alfa:~$ uname -n
alfa
anne@alfa:~$ uname -r
3.2.0-4-amd64
anne@alfa:~$ uname -v
#1 SMP Debian 3.2.51-1
anne@alfa:~$ uname -m
x86_64
anne@alfa:~$ uname -p
unknown
anne@alfa:~$ uname -i
unknown
anne@alfa:~$ uname -o
GNU/Linux

  • Here another interesting option which give us more information.
    In the past we’ve discussed the ls command used to display contents of directories and files.

    We can use the ls command to gather more system information.
    We will discuss only the most useful options here. To show ls options available by pressing the tab twice.
    You can see the available ls options below.
    Type ls + two times tab key.

anne@alfa:~$ ls
ls           lsattr       lsblk        lsb_release  lscpu        lsinitramfs  lsmod        lsof         lspci        lspgpot      lsusb
anne@alfa:~$ ls

  • At this moment your prompt shows ls. The lsattr command will display attributes of your working directory.
    Be aware this can be a very long list when your working directory is / ( root directory ).
    In this example is our home directory displayed.
    You must complete the ls command as followed.
    Type attr + enter.

anne@alfa:~$ ls
ls           lsattr       lsblk        lsb_release  lscpu        lsinitramfs  lsmod        lsof         lspci        lspgpot      lsusb
anne@alfa:~$ lsattr
————-e– ./Pictures
————-e– ./Downloads
————-e– ./Public
————-e– ./Desktop
————-e– ./Templates
————-e– ./Videos
————-e– ./Documents
————-e– ./Music
anne@alfa:~$

  • At this time after your first ls command executed your prompt is showed without ls. Now you need to type the whole command.
    If you want know how you disk looks like.
    Here you can see how many partitions you have. Notice the CD-Rom.
    Type lsblk + enter.

anne@alfa:~$ lsblk
NAME  MAJ : MIN RM     SIZE RO TYPE MOUNTPOINT
sr0         11:0     1         1024M  0 rom
sda          8:0      0             20G  0 disk
├─sda1   8:1     0          19.1G  0 part /
├─sda2   8:2     0                1K  0 part
└─sda5   8:5     0           880M  0 part [SWAP]
anne@alfa:~$

  • What kind of processor is installed in your computer.
    I you are interested about the properties, this command will show up technical information.
    Type lscpu + enter.

anne@alfa:~$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 30
Stepping:              5
CPU MHz:               1537.347
BogoMIPS:              3074.69
L1d cache:             32K
L1d cache:             32K
L2d cache:             6144K
NUMA node0 CPU(s):     0
anne@alfa:~$

  • I’m interested how many memory is used by the system.The default free command will display the information in KB format.
    If you want it in a human readable manner you must use the -h after your free command.
    Type free -h + enter.

anne@alfa:/$ free -h
total       used         free  shared    buffers     cached
Mem:              1.0G       776M      226M           0B         58M        424M
-/+ buffers/cache:       293M      709M
Swap:              879M          0B      879M
anne@alfa:/$

  • Last but not least the top command. System processes displayed in real time.
    Have you seen enough you can leave top by pressing q.
    (A imcomplete top page displayed)
    Type top + enter.

anne@alfa:/$ top

top – 19:16:30 up  4:36,  2 users,  load average: 0.01, 0.03, 0.05
Tasks: 125 total,   1 running, 124 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.4 us,  1.0 sy,  0.0 ni, 90.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   1027016 total,   808760 used,   218256 free,    60336 buffers
KiB Swap:   901116 total,        0 used,   901116 free,   440620 cached

  PID USER      PR  NI      VIRT     RES     SHR S     %CPU    %MEM      TIME+      COMMAND
2181 root        20   0      196m   65m    6092 S       2.3           6.5       1:29.23      Xorg
3253 anne      20    0     411m    24m     14m S      2.3            2.4       0:08.86      gnome-panel
3612 anne      20   0      306m    16m     10m S      1.0            1.7       0:15.53      gnome-terminal
3243 anne      20   0      366m    13m    9116 S       0.7           1.3       0:03.35      metacity
3127 anne      20   0      202m    10m    7768 S       0.3           1.0       0:00.64      x-session-manag
3282 anne      20   0      192m    9748   4428 S       0.3            0.9      0:00.23      tracker-store

  • Now we can do stuff what most people do, create, move, copy, delete folders and files.
    Now we’re able to advice many help functions in this magnificent system.
    As we’ve promised you to make a guide about move, create, change permissions etc…of directories and files.
    We’ll discuss this subject later on.
    We hope you enjoyed it and we’ll be back soon to guide us through the new chapter, management directories and files.
    Have a nice time -;)
Advertisements

Installing & Configuring HTTPD/Apache on CentOS 6.4

HTTPD/Apache is generally recognized as the world’s most popular Web server (HTTP server). Originally designed for Unix environments. The Apache Web server provides a full range of Web server features, including CGI, SSL, and virtual domains. Apache also supports plug-in modules for extensibility. Apache is free software, distributed by the Apache Software Foundation that promotes various free and open source advanced Web technologies.

This time we will divide this tutorial in two parts:

1. IP-based Virtual Hosts

a. One site per IP address

b.Host Header Names – multiple sites per IP address | port combination

2. Name-Based Virtual Hosts

a. NameVirtualHost 192.168.0.10 192.168.0.6

b. Then bind to each virtual host

So lets begin fir IP-Based Virtual Hosts

Apache by default, maintains 2 virtual hosts: TCP:80, TCP:443 determined by : /etc/httpd/conf/httpd.conf

So let’s begin by demonstration how to install and configure HTTPD/Apache

Pathfinder environment for HTTPD are :

“ /etc/httpd “ – this is primary config container

“ /etc/httpd/config/httpd.conf “ – this is primary config file under CentOS also RedHat.

yum install httpd

rpm –qa | grep –I httpd – this will enumerate package that have been installed and the man package is market with Red-X

1

When you install apache , you need to start from files that are located at httpd

Lets navigate to the file and see what we have there

cd /etc/httpd

ls –l  – here you will see the symlink of the httpd –Apache – the

run – directory simply contain a reference

logs – reference simple when you can find apache logs

2

enter command to see if the apache is running

ps –ef | grep –I httpd

pf –ef | grep httpd

service httpd status

Apache is not running yet

3

As mentioned before there are two directory for HTTPD-Apache

Conf – there are main configuration files

Conf.d – in Linux when ever you see .d suffix it means that is container of items that are included for larger configuration

Now  lets start HTTPD and see what will happen

Service httpd start

We have receive and error – this doesn’t mean that Apache is not running this is just DNS resolution problem but we will try to eliminate what kind of error we will receive , that is good for troubleshooting

4

let’s try to fix this:

vi /etc/sysconfig/network – change hostname to your hostname

5

vi /etc/hosts

6

Now type

Hostname yourhostname ( in my case is gnubizz.local) – as you see the error is gone

7

Now let’s continue where we left

netstat – ntl | grep 80 – you can see that the server has started

netstat –ntlp | grep 80 – the program is responsible is httpd

ps –aux | grep httpd – As you see primary apache process starts as root and subsequent processes run as apache(non-privileged users) and its defined on /etc/passwd

8

Now Apache is running lets tray to access the default page of Apache – open your browser and type either localhost or ip of your server

9

Let’s go a little bit deep , let’s change this default page and by default html file is stored on:

cd /var/www/html

vi index.html – close and check with browser

10

Note: Every changes that you made to HTTPD – Apache , issue reload and restart , and delete history and cookies for browser

Service httpd restart

or

!serv – this is a tip for shorts , Linux will remember last commands so than you can use ! and short names or by numbers  to restart the services or execute commands

An example of !

enter history command

ps –aux | grep httpd

11

!548

12

Now check with browser , you should have the same  page as it showing here

13a

Now we need to enable services for multi-user runlevels

chkconfig –list httpd – will show you the list

chkconfig httpd on  – this will enable runlevels

chkconfig –list httpd – do you see the difference

13

We need to check Apache logs, this is important when troubleshooting because apache traps messages between the client and servers and to see access and errors messages

cd /var/logs/httpd – this is default location

Check the access file first you can see how many time we have try to access our created website

watch tail access.log – main time refresh the browser and access again, do not close terminal you will see that again you changes in the terminal

My network has 254 available ip , so by  this l can assign to any pc or server within my house

So the CentOS that l am using has 192.168.0.4 gateway 192.168.0.1 255.255.255.0

First ip that l will assign to virtual interface will be 192.168.0.10 – l hope that is available 🙂

Ping 192.168.0.10 – l did not receive any replay this is good because l can see that this ip is available

ifconfig eth0:0 192.168.0.10

14

To have our website files in one place we need to create folders and give a name of our website

In my case l called my website site1.gnubizz.local ( your site you  can call as you wish )

mkdir /home/site1

mkdir /home/site1/www

cd /home/site1/www

vi index.html

15

Save and close

ls -l /home/site1 – to see who own the file , is owned by root , no need to owned by Apache , just read and write by apache that’s good

Capt

Now add a site1 and we need to be sure that Apache listens to 192.168.0.10:80

cd /etc/httpd/conf

vi site1.gnubizz.local.conf

16

save and close

Now navigate to :

vi /etc/httpd/conf/httpd.conf

As you can see here it’s already listen to port 80 , it tells here that it bind to all ip address

17

So we don’t want to bind to all ip addresses , we want to bind only to a specified ip address so that’s why we need to change

18

make symlink for site1

cd /etc/httpd/conf.d

ln –s ../conf site1.gnubizz.local.conf

service httpd restart

Note: incase you are facing problem accessing webpage you might check SElinux , pose problem when serving web content from: $HOME – so for temporary we need to disable

sestatus – check is Selinux is enabled

setenforce permissive

now point the browser with ip 192.168.0.10 – you should see this

19

So that’s it , you can add another site if you want just follow same steps ( site2, site3 )

cp site1.gnubizz.local.conf site2.gnubizz.local.conf

vi site2.gnubizz.local replace 1 with 2

cp -apvf /home/site1/www/index.html  /home/site2/www/index.html

ls -l /home/site2

modify vi /home/site2/www/index.html

than modify the /httpd.conf and add ip address ( 192.168.x.x )

cd /etc/httpd/conf.d

ln -s ../conf/site2.gnubizz.local.conf

browse new site called site2

So that’s it IP-Based Virtual Host

##########################################################################

Now lets begin with:

2. Name-Based Virtual Hosts

a. NameVirtualHost 192.168.0.10 192.168.0.6 – we have already configured

b. Then bind to each virtual host –  we have already configured

Add a second Virtual interface

20

We need to modify httpd.conf file

vi /etc/httpd/conf/httpd.conf – this time we will allow  to bind and listen in port 80

21

Save and close

Go to site1

vi /etc/httpd/conf.d/site1.gnubizz.local.conf – make the following changes

22

Save and close

Modify site2

vi /etc/httpd/conf.d/site2.gnubizz.local.conf

23

Save and close

Add this two virtual host to :

vi /etc/hosts

24

Check the status/names of virtualhosts

httpd –S – you can see that 192.168.0.10:80 is NameVirtualHost

Ca

Now try to access on browser by site name

Site1

25

Site2

26

Apache SSL | TLS with Self-Signet Certs – is ideal for intranet usage and default configuration includes self-signet certificates

yum install mod_ssl

yum install crypto-utils – check

we will generate a genkey for the host not for the website , l think is more appropriate for the defaults_:433   SSL site

type in terminal:

genkey gnubizz.local

click next

Capture

Select  2048 than Next – you have to wait sometime till the process finish

01-Capture

Click NO

02-Capture

We will not select this because every time any process that apache uses will require always  to be there and provide the password , it’s very secure of protecting your private key

03-Capture

Add information according your requirement

04-Capture

enter command to check who own the site1 directory

ls –l /home/site1

Capt

enter command to check site’s name and ssl.conf certificate

Ca

Make the changes on:

vi /etc/httpd/conf.d/ssl.conf

05

Now open the browser and check – you should have similar as shows in the pic

Select “ l Understand the Risks

06

Click on view

07

certificate has been issued

08

Note: The real key for this tutorial is  that you can issue your own self-cert or generate request via CA

So this is all , see you next time 🙂

Terminal exploration in home directory Debian Wheezy 7

Terminal exploration in home directory Debian Wheezy 7

It’s time to guide us through the system using Terminal. We can see the same folder structure as we have seen it in the graphical user interface.

Let’s take a tour.
Click on applications and highlight Accessories. Go to Terminal and open it.
On a fresh installed Debian system you will see a white window with text displayed anne@alfa:~$.

In this example is anne a default user.
anne        username who is logged on the system.
@alfa:     computername.
~$            Path: /home/anne.
Our prompt looks like this.

anne@alfa:~$

If we need high priveleges on the system we can login as root (administrator).
The root user can install, modify, change ownership, configure permissions, etc….
We can use the su or sudo command. When we use su you will logged as administrator until you execute the exit command.
Sudo is used for one action, no need to stay administrator after the task has ended. Example: sudo apt-get install……….

Type su and enter.
Type root user password and press enter.
Now we are logged as root user. Pay attention, we’re able to mess up the system ;-).
Notice the working directory.

anne@alfa:~$ su
Password:
root@alfa: /home/anne#

If you doubt who you are we can use the command whoami.
Type whoami and enter.
We can see at the prompt who is logged,
#
  root user

$  default user

anne@alfa:~$ su
Password:
root@alfa: /home/anne#  whoami
root
root@alfa: /home/anne#

We can discover who is logged.
execute the command who and enter.
Notice, you don’t see the root user.

anne@alfa:~$ su
Password:
root@alfa: /home/anne#  whoami
root
root@alfa: /home/anne# who
anne      tty7                         2013-10-25  09:54  (: 0)
anne      pts/ 0                      2013-10-25  09:54  (: 0. 0)
root@alfa: /home/anne#

Let’s go back and use our default user.
type exit and enter.
Our prompt is $ again.
Look what we will see when you execute who.
Who is logged in? The same users as we executed the command while we were root.
The root user runs on the background and is never displayed when you execute who.

anne@alfa:~$ su
Password:
root@alfa: /home/anne#  whoami
root
root@alfa: /home/anne# who
anne      tty7                         2013-10-25  09:54  (: 0)
anne      pts/ 0                      2013-10-25  09:54  (: 0. 0)
root@alfa: /home/anne# exit
exit
anne@alfa:~$ who
anne      tty7                         2013-10-25  09:54  (: 0)
anne      pts/ 0                      2013-10-25  09:54  (: 0. 0)
anne@alfa:~$

When we start the terminal the user default location is the home folder. The home directory can contain many users.
Sometimes it’s difficult to see where you’re working in. To solve this you can execute the pwd command.
Type pwd and enter. (print working directory).
/home/anne is the current working directory.

Wat’s in the box, you can use the command ls to look in your home folder.
Type ls and enter. ( list directory contents).
The ls command will display the contents of the home folder: Desktop, Documents, Downloads, Music, Pictures, Public, Templates and Videos.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop   Documents   Downloads   Music   Pictures   Public   Templates   Videos
anne@alfa:~$

We want to known who have created the folders and what the permissions are.
To do that we can execute the command ls -l.
Type ls -l( list directory contents) -l ( list one file per line)
The ls -l command will display the contents one file or directory per line.

In this example all directories displayed in an longer format.
d  directory
    file
   symbolic link
rwxr-xr-x  read, write, execute, read, none, execute, read, none, execute
2   ..link parent folder / . directory itself
anne anne  owner, group
4096  size directory
oct 17 16:25  last modifica;tion directory
Desktop, Documents, etc…   Directory

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop   Documentens   Downloads   Music   Pictures   Public   Templates   Videos
anne@alfa:~$ ls -l
total  32
drwxr-xr-x 2 anne anne 4096  Oct  17  16:25  Desktop
drwxr-xr-x 2 anne anne 4096  Oct  17  16:25  Documents
drwxr-xr-x 2 anne anne 4096  Oct  17  16:25  Downloads
drwxr-xr-x 2 anne anne 4096  Oct  17  16:25  Music
drwxr-xr-x 2 anne anne 4096  Oct  17  23:07  Pictures
drwxr-xr-x 2 anne anne 4096  Oct  17  16:25  Public
drwxr-xr-x 2 anne anne 4096  Oct  17  16:25  Templates
drwxr-xr-x 2 anne anne 4096  Oct  17  16:25  Videos
anne@alfa:~$

We can see even more than this. Show hidden directories and files in our home folder.
ls -l( list directory contents) -l ( list one file per line) -a ( do not ignore entries starting with .).
The ls -al command will display the contents one file or directory per line even the hidden ones.
Type ls -l and enter.

A dot before represents a hidden directory or file.
In this example:       .bash_history, .bash_logout are hidden files.
                                   .cache, .config are hidden directories.
We are able to see the contents of hidden directories and files.

type ls .local and enter.
The content of the hidden .local directory is share. The directory share isn’t hidden.

debian_64Bits-8


Sometimes we need to clean the screen in terminal, press ctrl+l or type clear screen and enter.
Your terminal looks like at the beginning.
Our working directory is /home/anne and the contents of it is:

Desktop, Documents, Downloads, Music, Pictures, Public, Templates and Videos.

anne@alfa:~$
anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop   Documentens   Downloads   Music   Pictures   Public   Templates   Videos
anne@alfa:~$

Let’s change the working directory to Documents.
Use cd + name directory you prefere command (change directory) Pay attention, it’s capital sensitive. Try and see what happens.
Type cd documents and enter.
bash: cd: documents: No such file or directory
This is faulty so let’s do it the right way.
Type cd Documents and enter.

Our working directory is now Documents.

anne@alfa:~$
anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop   Documentens   Downloads   Music   Pictures   Public   Templates   Videos
anne@alfa:~$ cd documents
bash: cd: documents: No such file or directory
anne@alfa:~$ cd Documents
anne@alfa:~$ ~/Documents$

We have different ways to navigate through our folder structure.
Our task is to go back in your home folder.
Change your directory by the cd command followed by  ~
Type cd ~
Your active directory is /home/anne

anne@alfa:~$ ~/Documents$ cd ~
anne@alfa:~$

Go back to Documents. type cd Documents + enter.
Execute cd .. and enter. (Leave a space between cd and ..)
You are at your home directory.

anne@alfa:~$ cd Documents
anne@alfa:~$ ~/Documents$ cd ..
anne@alfa:~$

Let’s do it one more time.
Type cd Documents and enter.
Type cd /home/anne and enter.
Now w’re in our home directory.

anne@alfa:~$ cd Documents
anne@alfa:~$ ~/Documents$ cd /home/anne
anne@alfa:~$

here a example how to navigate in your home directory. Play and enjoy it.  😉

debian_64Bits-11

We hope you have enjoyed it.
Next time we will create, modify, move, copy,  change permissions, etc….
Will be continued.

Installing GNS3 0.8.5 on Ubuntu 13.10

There are two ways to install GNS3 on Ubuntu :

First one is by Synaptic Package  Manager , it will install GNS3 in the way he want , we will not have full control of GNS3

Second we can install manually by creating folders and having  a full access on files , than we will have full control of GNS3

So in this tutorial we will do the second one :

Lets first get the latest update 

sudo apt-get update

Than install the following dependencies:

sudo apt-get install python
sudo apt-get install qt4-dev-tools
sudo apt-get install pyqt4-dev-tools
sudo apt-get install libncurses5-dev zlib1g-dev libsdl-dev libpcap-dev

Now create folder and change  access permissions for GNS3 

cd /opt

sudo mkdir GNS3_Folder && sudo chmod 777 GNS3_Folder

cd GNS3_Folder
mkdir projects && chmod 777 projects
mkdir images && chmod 777 images
mkdir temp && chmod 777 temp
mkdir cache && chmod 777 cache
mkdir qemu && chmod 777 qemu
mkdir captures && chmod 777 captures
mkdir dynamips && chmod 777 dynamips

Now we need to download the packages :

cd /opt/GNS3_Folder

wget http://sourceforge.net/projects/gns-3/files/GNS3/0.8.5/GNS3-0.8.5-src.tar.bz2

cd /opt/GNS3_Folder/dynamips

wget http://sourceforge.net/projects/gns-3/files/Dynamips/0.2.8-RC2/dynamips-0.2.8-RC2-x86.bin

cd /opt/GNS3_Folder/qemu

wget http://sourceforge.net/projects/gns-3/files/Qemu/Linux/QEMU-0.14.1b-GNS3-Ubuntu-Linux.tgz

Now let’s go back to GNS3_Folder and untar files

cd /opt/GNS3_Folder

sudo tar jxvf GNS3-0.8.5-src.tar.bz2

sudo chmod 777 GNS3-0.8.5-src

cd /opt/GNS3_Folder/GNS3-0.8.5-src

sudo chmod 777 *.*   – this will set full permission to files inside GNS3-0.8.5-src

cd /opt/GNS3_Folder/dynamips

sudo chmod 777 dynamips-0.2.8-RC2-x86.bin

cd /opt/GNS3_Folder/qemu

sudo tar -xvzf QEMU-0.14.1b-GNS3-Ubuntu-Linux.tgz

cd QEMU-0.14.1b-GNS3

./Qinstall  – this will install qemu for GNS3

Now open GNS3 through CLI via Terminal

sudo /opt/GNS3_Folder/GNS3-0.8.5-src/gns3

Selection_010

General:

we will configure some setting – the setting should be as they appearing on the picture

Selection_012

Dynamips:

After changing setting click on ” Test Settings ”

Selection_013

Capture: 

This will save all network traffic when you will use wireshark

Selection_014

Qemu: 

After you done changes to your setting click on ” Test Settings ”

Selection_015

If you want to create shortcut or launcher on desktop than try the following

sudo apt-get install gnome-panel

gnome-desktop-item-edit –create-new ~/Desktop

gksu python “/opt/GNS3_root/GNS3-0.8.5-src/gns3”

Selection_017

So this was installing GNS3 on Ubuntu 13.10 – do not hesitate to contact me if you are facing any problems

 

 

Installing LAMP on Debian Wheezy

This tutorial will show you have you can install a LAMP on Debain Wheezy , an setup of Debian that can act as a LAMP server.

LAMP server stands for Linux, Apache, MySQL and PHP

For this tutorial, l have been using Debian Wheezy 7.2 net-install and used minimal installation , so in one words no GUI , and used VirtualBox 4.2

Download Link for Debian:  http://www.debian.org/devel/debian-installer/

Download Link for VirtualBox : https://www.virtualbox.org/wiki/Downloads

To confirm this 🙂 here is the first picture

42

For this tutorial l use vi editor , but if you prefer other editors such as nano or pico  you can freely use

For those that they want to use vi editor

apt-get install vim-nox

Lets begin first by installing ntp because need our system to have time synchronized

Installing NTP

apt-get install ntp

invoke-rc.d ntp restart – this will restart ntp

or

/etc/init.d/ntp restart

or

service ntp restart

l prefer first one 🙂

Now we will change ip address from dhcp to static, because servers always need to have a static ip

DHCP-to-STATIC

vi /etc/network/interfaces

Selection_003

restart network int – invoke-rc.d networking restart

See if you can ping google
ping http://www.google.com
dig google.com

Is everything good now – ok lets begine other installation process 🙂

Installing MySQL

apt-get install mysql-server mysql-client

you will be asked to provide a password for MySQL , the password is for root users, see the pic below

Selection_001

Selection_002

Restart MySQL – invoke-rc.d mysql restart

Installing Apache2

apt-get install apache2

Restart apache – invoke-rc.d apache2 restart

Now to check if the apache works , open the browser and give ip of your server , if you get the similar page like this one you see here , this mean that apache is on ( working )

56

If you happen to recieve this kind of warning “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” than follow this steps

vi /etc/apache2/conf.d/httpd.conf and add lines
ServerName localhost

Remember you must always restart apache to apply this changes
invoke-rc.d apache2 restart

Installing PHP5

apt-get install php5 libapache2-mod-php5

The document root of the default web site is /var/www. We will now create a PHP file “info.php” in that directory and try to access it from browser. The file will display of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php – add the following lines

<?php
phpinfo();
?>

invoke-rc.d apache2 restart

try to access from browser –

” ipaddofserver/info.php ”

To get MySQL support in PHP, we need to  install the php5-mysql package

apt-get install php5-mysql

Install phpMyAdmin – is a web interface through which you can manage your MySQL databases

apt-get install phpmyadmin

65

that’s it , your server is up and running now ….

You can ask and write comments below , l will be happy to answer you

… gnu bizz …

Today, October 17, 2013 we are keeping our inaugural GnuBizz conference.

 

Four Pioneers:

Anne Misson
Lulzim Veliu
Manuel André
Bert Vandenbroeck

and our Founder

Jan Bergmans

After testing and tinkering with a lot of open source software, we hope to present you a.s.a.p. with brand new posts on this blog.