Configure lamp environment _linux under Linux

Source: Internet
Author: User
Tags bz2 install php unpack touch command phpmyadmin

1. Prepare

Depending on the system, the files may be prepared differently, I use Ubuntu Linux, I have the following five files packaged, click the link below to download it

Httpd-2.2.9.tar.gz

Mysql-5.1.52.tar.gz

Php-5.3.5.tar.gz

Libxml2-2.7.7.tar.gz

Ncurses-5.6.tar.gz

Baidu Network disk Download: Linux Lamp Environment Installation package

2. Install MySQL

Copy Code code as follows:

Need to add MySQL group and user before installing
Add user group user, get root right First
trigkit4@ubuntu:~$ su Root
Password:
root@ubuntu:/home/trigkit4# Groupadd MySQL
root@ubuntu:/home/trigkit4# useradd-g MySQL MySQL
Unpack the compressed package, first enter the directory where the download files are located
$ cd/home/trigkit4/downloads TAR-ZXVF mysql-5.1.52.tar.gz
into the unpacked folder
root@ubuntu:/home/trigkit4/downloads# CD mysql-5.1.52
Access Directory Decompression ncurses-5.6.tar.gz
Cd/home/trigkit4/downloads TAR-ZXVF ncurses-5.6.tar.gz
Enter the ncurse-5.6 folder again
root@ubuntu:/home/trigkit4/downloads/mysql-5.1.52# cd/home/trigkit4/downloads/ncurses-5.6
Configure installation directory and other information
./configure--prefix=/usr/local/ncurses--with-shared--without-debug--enable-widec
Compile, a bit time-consuming
root@ubuntu:/home/trigkit4/downloads/ncurses-5.6# make
Installation
root@ubuntu:/home/trigkit4/downloads/ncurses-5.6# sudo make install

3. Install Apache

Copy Code code as follows:

First enter the directory where httpd-2.2.9.tar.gz
cd/home/trigkit4/downloads/
Extract the Apache file bundle
$ TAR-ZXVF httpd-2.2.17.tar.gz
Enter the extracted file directory
root@ubuntu:/home/trigkit4# cd/home/trigkit4/downloads/httpd-2.2.9
Configure installation directory
root@ubuntu:/home/trigkit4/downloads/httpd-2.2.9#./configure-prefix=/home/trigkit4/downloads/apache-enable-so
Compile
root@ubuntu:/home/trigkit4/downloads/httpd-2.2.9# make
Installation
root@ubuntu:/home/trigkit4/downloads/httpd-2.2.9# sudo make install

4. Install LIBXML2

Copy Code code as follows:

Enter the directory where the libxml2 file resides
root@ubuntu:/home/trigkit4# cd/home/trigkit4/downloads
Unpack Libxml Packages
TAR-ZXVF libxml2-2.7.7.tar.gz
Enter the extracted file directory
root@ubuntu:/home/trigkit4/downloads# CD libxml2-2.7.7
Configuration
$./configure
Compile
$ make
Installation
$ sudo make install

5. Install PHP

Copy Code code as follows:

Enter the directory where PHP files are located and unzip
$ TAR-ZXVF php-5.3.5.tar.gz
Enter the extracted file directory
root@ubuntu:/home/trigkit4/downloads# cd/home/trigkit4/downloads/php-5.3.5
Enter the libxml2 file directory and install LIBXML2
./configure--prefix=/usr/local/libxml2/
Configuration directory
./configure--with-apxs2=/opt/www/bin/apxs

Compile
$ make
Installation
$ make Install

Configuration

Copy Code code as follows:

Copy PHP's configuration file
# CP Php.ini-development/usr/local/php/etc/php.ini
Configure Apache
# gedit/home/trigkit4/downloads/apache/conf/httpd.conf
Add LoadModule php5_module to LoadModule place module/libphp5.so
Add index.php at DirectoryIndex
Add at AddType application
AddType application/x-httpd-php. php. phtml
AddType Applicatoin/x-httpd-php-source. Phps
Then restart Apache, and the settings will take effect.
Home/trigkit4/downloads/apache/bin/apachectl restart

Linux Common commands

View Table of Contents

Copy Code code as follows:

Cd.. Go back to the previous level
CD ~ Return to the default root directory
Cd.. /.. Return to Superior's superior
command echo to show what was entered
Command Cat to display file contents
Command head displays the first few lines of the file (default 10 lines)-n Specifies the number of rows to display
Command tail to display the end of a file (default 10 lines)-n Specifies the number of rows to display-----------------F
command more to page the contents of the file (only page Down)
Command less for paging the contents of the file (with page up and down)

Date Time

Copy Code code as follows:

Command date to view and set the current system time: Format display time: +%y-%m-%d
Command Hwclock (clock) To display hardware clock time
Command cal used to view calendars
Command uptime to view system run time

View hardware Information

Copy Code code as follows:

Command LSPCI to view PCI Settings-V View details
Command Lsusb to view USB Settings-V View details
Command lsmod to view loaded modules (drivers)

Shutdown, reboot

Copy Code code as follows:

-H Turn off the computer,-R restart
Shut down immediately: Shutdown-h now
10 minutes after shutdown: shutdown-h +10
Command Poweroff for immediate shutdown
Command reboot to restart the computer immediately

Archive, Compress

Copy Code code as follows:

The tar command is used to archive files
Command zip to compress file zip Linuxcost.zip myfile
Command unzip to extract the zip file unzip Linuxcast.zip
Command gzip to compress files gzip linuxcast.net
Tar command
The "tar" command is a tape archive (Tape Archive) that is useful for archiving and extracting files that are created.
root@trigkit4:~# TAR-ZXVF abc.tar.gz (remember ' z ' represented. tar.gz)
root@trigkit4:~# TAR-JXVF abc.tar.bz2 (Remember ' j ' stands for. tar.bz2)
root@trigkit4:~# TAR-CVF archieve.tar.gz (. bz2)/PATH/TO/FOLDER/ABC
TAR-CVF/TMP/ETC.TAR/ETC <== only packaged, not compressed!
Tar-zcvf/tmp/etc.tar.gz/etc <== after packaging to gzip compressed
Parameters:
-C: Create a compressed file parameter instruction (create meaning);
-x: Unlock a parameter command for a compressed file!
-T: View the files inside the Tarfile!
In particular, in the release of the parameters, c/x/t can only exist one! Not exist at the same time!
Because it is not possible to compress and decompress at the same time.
-Z: Do you have gzip properties at the same time? Is that the need to use gzip compression?
-j: Do you have bzip2 properties at the same time? That is to use bzip2 compression?
-V: Display files during compression! This is commonly used, but is not recommended for use in the background execution process!
-F: Use file name, please note that after F to immediately receive file name Oh! Don't add any more parameters!
For example, the use of "TAR-ZCVFP tfile sfile" is the wrong way to write
"TAR-ZCVPF tfile sfile" is right!
-P: Use the original properties of the original file (properties will not be changed according to the user)
-P: You can use absolute paths to compress!
-N: Newer than the following date (YYYY/MM/DD) will be packaged into the newly created file!
--exclude file: Do not package file in the process of compression!
Find/Compile
Command locate to quickly find files, folders locate keyword
Command find to find the files, folders, find lookup location
The process of installing each source code package on a Linux system is as follows:
Configuration (Configure)
Compile (make)
Install (make install)
See Linux kernel version, System Information, commonly used in three ways:
uname-a; more/etc/issue; Cat/proc/version;

Apache Command

Copy Code code as follows:

Restart Apache
Home/trigkit4/downloads/apache/bin/apachectl restart
Apahce Start command:
/home/trigkit4/downloads/apache/bin/apachectl Start APACEH
Apache Stop Command
/home/trigkit4/downloads/apache/bin/apachectl stop

Other common commands

Copy Code code as follows:

PWD Display work path
LS View the files in the directory
Ls-f view files in a directory
The ls-l command lists the contents of the folder in detail mode (long listing fashion).
The "ls-a" command lists all the contents of the folder, including the "." The hidden file at the beginning.
The "History" command is a historical record. It shows the history of all the commands that have been executed in the terminal.
The "sudo" (Super User Do) command allows authorized users to execute commands from Superuser or other users.
The Make Directory command creates a new directory under the named Path (mkdir).
The touch command represents the update of the file's access and modification time to the current time.
The "chmod" command is the mode bit that changes the file.
The "chown" command is to change the owner of the file and the group of users.
"Cat" represents the link (concatenation), connects two or more text files, or prints the contents of the file as standard output.
Cal (Calender), which displays the current month or month in the future or any previous year.
The date command prints the current date and time using standard output, or it can be set in depth.
CP command: "Copy" is copy. It will copy a file from one place to another place.
The MV command moves one place's files to another.
grep command: The grep command is a powerful text search tool that can use regular expressions to search for text and print matching rows. The grep full name is global Regular Expression Print, which represents the globally regular expression version
Groupadd group_name Create a new user group
The function of the clear command is to purge information on the screen, similar to the CLS command in DOS.
WHOAMI: Check the current logged-on user name
CD: Go to specified folder, using: CD [Target path]
Linux systems are case sensitive. VI is a command line interface of text editing tools, known as Emacs

Vim Common commands

Copy Code code as follows:

Vim Command mode common commands:
Press the ":" Key in command mode to enter ex mode, commonly used commands
I: Insert text before the cursor: W Save current changes
O: Inserts a new row below the current line: Q exit
DD: Delete whole line: x Save and exit
YY: Copy current line:! Execute a system command and display the results
N+yy: Copy n rows: Set number shows line numbers
P: Paste
U: Undo Last Action
R: Replace the current character
/: Find Keywords

Additional: Ubuntu Linux installation Tutorial

Copy Code code as follows:

The first step is to install Apache2
sudo apt-get install apache2
The second step is to install the PHP module
sudo apt-get install php5
The third step is to install MySQL
sudo apt-get install Mysql-server
sudo apt-get install mysql-client
Fourth step installation of other modules
sudo apt-get install LIBAPACHE2-MOD-PHP5
sudo apt-get install Libapache2-mod-auth-mysql
sudo apt-get install Php5-mysql
sudo apt-get install PHP5-GD
Step Fifth Test if Apache works
Open the browser and enter localhost to see if there is an IT works! page display. Directory for/var/www
Sixth Step Modify Permissions/var/www
sudo chomod 777/var/www
Seventh Step installation phpMyAdmin
sudo apt-get install phpMyAdmin
Eighth Step Test phpMyAdmin
sudo ln-s/usr/share/phpmyadmin/var/www
Then run http://localhost/phpmyadmin directly to see if any database management software appears.

Please take a moment to share the article with your friends or leave a comment. We will sincerely thank you for your support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.