Linux Basics And Apache Installation 01:09:18 1
Operating System 01:09:18 2
Operating System 01:09:18 3
Operating System 01:09:18 4
Operating System Duties Process Management Memory Mgmt I/O Managemnt File Management 01:09:18 5
Operating System 01:09:18 6
Enable root Login in Ubuntu 14.04 sudo -i passwd root /etc/lightdm/lightdm.conf [SeatDefaults] greeter-session=unity-greeter user-session=ubuntu greeter-show-manual-login=true
Enable root Login in Ubuntu Desktop 14.04 Edit /etc/gdm/custom.conf file and include AllowRoot=true. sudo passwd -dl root (to disable)
dd if=/path/to/ubuntu.iso of=/dev/sdb bs=1M Create bootable USB umount /dev/sdb dd if=/path/to/ubuntu.iso of=/dev/sdb bs=1M 01:09:19 10
File System A file system or filesystem is used to control how data is stored and retrieved. The structure and logic rules used to manage the groups of information and their names is called a "file system". 01:09:19 11
File System of Linux
LINUX DIRECTORY STRUCTURE
File System Linux uses Ext2, Ext3, Ext4 01:09:19 14
File System Ext2 stands for second extended file system. It was introduced in 1993. Developed by Rémy Card. 01:09:19 15
File System Ext2 Ext2 stands for second extended file system. It was introduced in 1993. Developed by Rémy Card. Ext2 does not have journaling feature Maximum individual file size can be from 16 GB to 2 TB Overall ext2 file system size can be from 2 TB to 32 TB 01:09:19 16
File System EXT3 Ext3 stands for third extended file system. It was introduced in 2001. Developed by Stephen Tweedie The main benefit of ext3 is that it allows journaling Maximum individual file size can be from 16 GB to 2 TB Overall ext3 file system size can be from 2 TB to 32 TB
File System EXT4 Ext4 stands for fourth extended file system. It was introduced in 2008. \Maximum individual file size can be from 16 GB to 16 TB Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
Formating drive and usb #fdisk -l # mkfs.ext4 /dev/device 01:09:19 19
File System
File System
File System
File System
Formating drive and usb umount /dev/sda2 tune2fs -j /dev/sda2 mount /dev/sda2 /home
Source List To Add source list /etc/apt/sources.list 3rd pary installation /etc/apt.sourceslist.d 01:09:19 25
Source List deb http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted deb-src http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted deb file:/mnt/debian-dvd/ wheezy main contrib
System back add-apt-repository -y ppa:nemh/systemback sudo apt-get update sudo apt-get install systemback
Linux Basic Commands ls cp [option(s)] sourcefile targetfile mv [option(s)] sourcefile targetfile rm [option(s)] file(s) -r . Deletes any existing subdirectories cd [options(s)] [directory] mkdir [option(s)] directoryname rmdir [option(s)] directoryname
Linux Basic Commands ln [option(s)] sourcefile targetfile chown [option(s)] username.group file(s) R- Changes files and directories in all subdirectories. chgrp [option(s)] groupname file(s) adduser user group
Linux Basic Commands chmod [options] mode file(s) u-user g-group o-others For access, access is granted by the + symbol and denied by the – symbol. r-read ,w-write ,x- execute
Linux Basic Commands grep [option(s)] searchstring filenames mount [option(s)] [<device>] mountpoint du [option(s)] [path] -h human redable free [option(s)]
Linux Basic Commands kill [option(s)] process ID ping [option(s)] host name|IP address
Setting Proxy export http_proxy="http://usrname:passwrd@host:port" /etc/environment http_proxy=http://127.0.0.1:5865 /etc/apt/apt.conf Acquire::http::Proxy "http://127.0.0.1:5865";
Mount command Mount -t <file system ? <souce> <dest> Fdisk -l
Netwoking in Ubuntu sudo vi /etc/network/interface iface eth0 inet static address 192.168.3.3 netmask 255.255.255.0 gateway 192.168.3.1 dns-search example.com dns-nameservers 192.168.3.45 192.168.8.10
Networking sudo /etc/init.d/networking restart Or Reboot.
Networking #ip addr show #Ifconfig # ip addr del 192.168.50.5/24 dev eth1 # ip link set eth1 up # ip link set eth1 down
Networking # ip route show #ping <IP>
Web Server The term web server can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver web content that can be accessed through the Internet. A user agent, commonly a web browser or web crawler, initiates communication by making a request for a specific resource using HTTP and the server responds with the content of that resource 39 39
Web Server 40 40
Web Server 41 41
Web Server 42 42
Popular Web Server Apache HTTP Server (open source) Microsoft Internet Information Services (IIS) NGINX, Inc (open source) Google -GWS Sun Java System Web Server TEQIP_GEC_WAYANAD_25_June 43 43
Popular Web Server 44 44
LAMP LAMP (Linux, Apache, MySQL, PHP/Perl/Python) is a package that contains a web server (Apache). This is a piece of software that actually runs your web application. Frameworks are, in short, libraries that help you develop faster.
LAM
LAMP
Apache Apache httpd has been the most popular web server on the Internet since April 1996, and celebrated its 17th birthday as a project this February. The Apache HTTP Server ("httpd") is a project of The Apache Software Foundation. open-source HTTP server for modern operating systems including UNIX and Windows NT 48 48
Apache 49 49
Apache Apache httpd 2.4.25 (released 2016-12-20) 50 50
Apache2 apt-get -y install apache2 vi /etc/apache2/conf-enabled/security.conf # line 26: change ServerTokens Prod # line 37: change ServerSignature Off
Apache2 vi /etc/apache2/mods-enabled/dir.conf # line 2: add file name that it can access only with directory's name DirectoryIndex index.html index.htm
Apache2 vi /etc/apache2/apache2.conf # line 70: add server name ServerName www.srv.world
Apache2 vi /etc/apache2/sites-enabled/000-default.conf # line 11: change admin email address ServerAdmin webmaster@srv.world /etc/init.d/apache2 restart
Apache2 http://(your server's hostname or IP address)/
Supporting PHP pages GECTCR_13_ JAN_2016 56 56
Apache2-PHP # apt-get -y install php5 php5-cgi libapache2-mod-php5 php5-common php-pear #a2enconf php5-cgi.conf #/etc/init.d/apache2 restart
Apache2-PHP vi /var/www/html/index.php <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align:center;"> <?php print Date("Y/m/d"); ?> </div> </body> </html>
Apache2-Enable Userdir # a2enmod userdir /etc/init.d/apache2 restart mkdir ~/public_html vi ~/public_html/index.html <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> UserDir Test Page </div> </body> </html>
Virtual Hosting GECTCR_13_ JAN_2016 60 60
Virtual Hosting Virtual hosting is a method for hosting multiple domain names (with separate handling of each name) on a single server (or pool of servers) This allows one server to share its resources, such as memory and processor cycles, without requiring all services provided to use the same host name. 61 61
Virtual Hosting One widely used application is shared web hosting. Shared web hosting prices are lower than a dedicated web server because many customers can be hosted on a single server. 62 62
Apache2-Virtual Hostings # vi /etc/apache2/sites-available/virtual.host.conf # create new for virtualhost <VirtualHost *:80> ServerName www.virtual.host ServerAdmin webmaster@virtual.host DocumentRoot /home/ubuntu/public_html ErrorLog /var/log/apache2/virtual.host.error.log </VirtualHost>
Apache2-Virtual Hostings #a2ensite virtual.host /#etc/init.d/apache2 restart
Apache2-Virtual Hostings $ mkdir ~/public_html vi ~/public_html/index.html <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Virtual Host Test Page </div> </body> </html>
Basic Authentication A simple user ID and password-based authentication scheme, and provides the following: To identify which user is accessing the server To limit users to accessing specific pages (identified as Universal Resource Locators, URLs 66 66
SSL and Certificates The Secure Socket Layer protocol was created by Netscape to ensure secure transactions between web servers and browsers. 67 67
SSL Secure Sockets Layer (SSL), are cryptographic protocols that provide communication security over the Internet. 68 68
SSL GECTCR_13_ JAN_2016 69 69
SSL GECTCR_13_ JAN_2016 70 70
SSL Communication 71 71
Apache2 -SSL Settings vi /etc/apache2/sites-available/default-ssl.conf # line 3: change to admin email ServerAdmin webmaster@gecskp.ac.in # line 32,33: change to the one created in [1] SSLCertificateFile /etc/ssl/private/server.crt SSLCertificateKeyFile /etc/ssl/private/server.key
Apache2 -SSL Settings # a2ensite default-ssl # a2enmod ssl #/etc/init.d/apache2 restart
SSL WEBSITES www.gmail.com www.yahoo.com www.onlinesbi.com www.irctc.co.in Etc etc etc....... 74 74
Apache2 -Use Basic Auth # apt-get -y install apache2-utils # vi /etc/apache2/sites-available/auth-basic.conf # create new <Directory /var/www/html/auth-basic> AuthType Basic AuthName "Basic Authentication" AuthUserFile /etc/apache2/.htpasswd require valid-user </Directory>
Apache2 -Use Basic Auth # htpasswd -c /etc/apache2/.htpasswd test # mkdir /var/www/html/auth-basic # /etc/init.d/apache2 restart # vi /var/www/html/auth-basic/index.html <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Test Page for Basic Auth </div> </body> </html>
Webserver & Database GECTCR_13_ JAN_2016 77 77
Install MySQL # apt-get -y install mysql-server #/etc/init.d/mysql start # mysql -u root -p mysql> select user,host,password from mysql.user;
Install phpMyAdmin # apt-get -y install phpmyadmin # vi /etc/phpmyadmin/apache.conf # near line 8: add lines below Require ip 127.0.0.1 10.0.0.0/24 # /etc/init.d/apache2 restart
PhpMyAdmin PPA sudo add-apt-repository ppa:nijel/phpmyadmin sudo apt-get update
Install phpMyAdmin Create db connect php code
SAMBA SERVER
SAMBA SERVER
SAMBA SERVER # apt-get -y install samba # mkdir /home/share # chmod 777 /home/share
SAMBA SERVER # vi /etc/samba/smb.conf # near line 25: add unix charset = UTF-8 # line 30: change (Windows' default) workgroup = WORKGROUP # line 51: uncomment and change IP address you allow interfaces = 127.0.0.0/8 10.0.0.0/24
SAMBA SERVER # line 58: uncomment bind interfaces only = yes # line 60: add (no auth) map to guest = Bad User
SAMBA SERVER # add at the last line [Share]# any name you like path = /home/share# shared directory writable = yes# writable guest ok = yes# guest OK guest only = yes# guest only create mode = 0777# fully accessed directory mode = 0777# fully accessed share modes = yes# warn if some people access to a file
SAMBA SERVER # initctl restart smbd
SAMBA SERVER # groupadd security # mkdir /home/security # chgrp security /home/security # chmod 770 /home/security # vi /etc/samba/smb.conf
SAMBA SERVER # line 60: comment out # map to guest = Bad User
SAMBA SERVER [Security]# any name you like path = /home/security writable = yes create mode = 0770 directory mode = 0770 share modes = yes guest ok = no# guest not allowed valid users = @security# allow only security group
SAMBA SERVER # smbpasswd -a trusty # add a user in Samba # usermod -G security trusty # initctl restart smbd
FTP Server
FTP Server # apt-get -y install vsftpd #vi /etc/vsftpd.conf
FTP Server # line 29: uncomment write_enable=YES # line 97,98: uncomment ( allow ascii mode transfer ) ascii_upload_enable=YES ascii_download_enable=YES
FTP Server # line 120: uncomment ( enable chroot ) chroot_local_user=YES # line 121: uncomment ( enable chroot list ) chroot_list_enable=YES
FTP Server # line 123: uncomment ( enable chroot list ) chroot_list_file=/etc/vsftpd.chroot_list # line 129: uncomment ls_recurse_enable=YES
FTP Server # add at the last line # specify root directory ( if don't specify, users' home directory equals FTP home directory) local_root=public_html # turn off seccomp filter seccomp_sandbox=NO
FTP Server #vi /etc/vsftpd.chroot_list # add users you allow to move over their home directory test
FTP Server #initctl restart vsftpd
Govt.Engg.College Sreekrishnapuram Palakkad 9539601112 SIJO S VADAKKAN Govt.Engg.College Sreekrishnapuram Palakkad 9539601112 01:09:19 GEC KANNR _JAN_2017 101 101