Pages

23 October 2010

Important Basic Linux Command

Before posting on any other advance server topic, I think , must post some basic commands of linux. Because most people hunting for this comman every time. here we are going to write most usable basic command.

Command    -----   Syntax    ---------   Purpose

1.  ls  ---- ls   ---   List files & directories

2.  ls -l  ----  ls -l   ----   List files & directories with extra information e.g. permission, ownership, size & modification date

3.  ls -ltr  ----   ls -ltr  ------   This command shows all information as "ls -l" but alway show last created or modified file/dir at bottom

4.  cd   ----  cd  -----  Move to users' root directory from any where
       
                  cd ..     -----   Move to the parent directory of the current directory.For example if you are in /home/user/dir, then this comman move                             you in /home/user
       
                 cd /etc   -----  Change the current working directory to /etc or you can enter into directory using this command.
   
5.  mkdir  ----  mkdir mydirectory   ----   Create "mydirectory" ( you can replce mydirectory with any name you want for directory you are creating)

6.  touch  ----   touch file01   ----    Creates a blank file if not exist or update if exist.

7.  cat  ----  cat file01  ----     Shows contents of file01
       
                  cat  > file02  ----   Create file named file02       
   
                  cat >> file02  ----  Can append contents of file02

                        ( to save data with cat press CTRL+D or CTRL+C for cancle)

8.  less  ----   less /etc/passwd   -----  For navigate file contents or standard input

9.  head  ----  head /etc/passwd  ----   Show top 10 lines of file

10. tail  ----  tail /etc/passwd  ----  Show bottom 10 lines of file

11. pwd  ---- pwd  ----- Show current working directory

12. cp  --- cp file01 /tmp  ----   Create duplicate of file01 to /tmp

13.  mv  ----   mv file01 file02   ---- Rename file01 into file02
       
                     mv file01 /tmp  ----    Move file01 into /tmp

15 June 2010

Configure LAMP For Newbies

What is LAMP ?

LAMP is an acronym for a solution stack of free, open source software, originally coined from the first letters of Linux (operating system), Apache HTTP Server, MySQL (database software), and PHP, principal components to build a viable general purpose web server

Linux

Linux is a Unix-like computer operating system kernel. A major emphasis of Linux development is security, which makes it an appealing choice for a web-server application. Like the other LAMP components, Linux is free open-source software which means the source code is provided with operating system, which can be edited according to specific needs. Also, because Linux-based operating systems are Unix-like, a Linux server is more natively-compatible with other server-oriented platforms, such as Solaris and BSD, than non-Unix-like systems like Microsoft Windows.


Apache

Apache is a free software/open source web server, the most popular in use

MySQL

MySQL is a multithreaded, multi-user, SQL database management system (DBMS) with more than eleven million installations. Since 16 January 2008, owned by Sun Microsystems, as of 20 April 2009, Oracle Corporation has agreed to purchase Sun Microsystems.

Perl, PHP, or Python

PHP is a reflective programming language originally designed for producing dynamic web pages. PHP is used mainly in server-side application software. Perl and Python can be used similarly.


Installation of LAMP

Here I am assuming you have already installed Linux on your PC/server.

First of all we are installing Apache, Mysql-server & php

# yum install httpd mysql-server php php-mysql

# chkconfig httpd on
# chkconfig mysqld on
# service httpd restart
# service mysqld restart


Made mysql running to add user & password

# mysqladmin -u root password [your_password]

Login on to mysql-server

# mysql -uroot -p[your_password]

Now time to Publish a website with LAMP

for apache /var/www/html is default directory where you can place your own webdata
here we are creating a simple HTML file for testing.

# echo "This is my first web site" > /var/www/html/index.html

# service httpd restart

Open a web browser and type on address bar

http://localhost

Here you can see page with messege "This is me first web site"

Congrats, Now you are ready to work on LAMP

Linux FTP Server Setup

This tutorial is concentrating on setting up a real environment of FTP server.

To configure FTP server in Linux vsftpd is  a default package which I am using.

First of all install the vsftpd package on your Linux server. I am using CentOS Linux.

#yum install vsftpd

Now entering in vsftpd.conf  using vim command


#vim /etc/vsftpd/vsftpd.conf

# Allow anonymous FTP?
# anonymous_enable=YES

# Uncomment this to allow local users to log in.
local_enable=YES

Restart the vsftpd service

#chkconfig vsfftp on
#service vsftpd restart

Now create a users group named ftpusers
#groupadd ftpusers

Create a directory on root

#mkdir /www


Make the directory accessible to the ftpusers group:  
 #chmod 775 /www
#chown root:ftpusers /www


Now finally add ftp users with default directory www
#useradd -g ftpusers -d /www user01
#passwd user001

Your FTP server has configured now :

Now testing phase

login to ftp server with command mode

#ftp localhost
username - user01
password - your password

Supply pwd command to see your home directory


Always remember to add firewall exception for FTP service to access from remote client