Install lamp in ubuntu9.04

Source: Internet
Author: User
Tags mcrypt ssh server fully qualified domain name

I. Installation
1. First Install SSH
Sudo apt-Get Install SSH

2. Install MySQL (although the latest version is 5.1, only MySQL 5.0 can be installed)
Sudo apt-Get install mysql-server-5.0
3. install Apache
Sudo apt-Get install apache2
4. install PHP
Sudo apt-Get install PhP5 libapache2-mod-php5
5. Restart Apache
Sudo/etc/init. d/apache2 restart
6. Install phpMyAdmin
Sudo apt-Get install phpMyAdmin
Another method: Install Lamp
Select edit in the new software package manager -- mark the software package with the Task Group
In the displayed window, select lamp server and then confirm
In the main window, click the application button of red/Palladium
Well, the next step is to wait until the new version is automatically downloaded and installed.
You will be prompted to enter the MySQL Root User Password.
Ii. Test
1. Test Apache
Enter http: // localhost/to check whether the words it works appear.
2. Test MySQL
Input: sudo netstat-tap | grep MySQL
You can see rows similar to the following:
TCP 0 0 localhost. localdomain: MySQL *: * listen-
If the server cannot run properly, run the following command to start it: sudo/etc/init. d/MySQL restart
3. Test PHP
The root directory of ubuntu Apache is located in/var/www.
Add a test file test. php file to the file.
<? PHP
Phpinfo ();
?>
Enter http: // localhost/test. php again in the browser. If the PHP information page is displayed, the PHP installation is successful.

Iii. Configuration

1> Apache configuration file path/etc/apache2/apache2.conf
2> PHP. ini path/etc/PhP5/apache2/php5.ini
3> MySQL configuration file path/etc/MySQL/My. CNF
4> phpMyAdmin configuration file path/etc/PHPmyAdmin/Apache. conf
5> website root directory/var/WWW

1. Configure PhP5

There is nothing to say about it. The default time zone is shown below as needed.
; Default. timezone = PRC (remove the semicolon above to represent China)

2. Configure MySQL

Sudo gedit/etc/MySQL/My. CNF
Note that only local access to the database is allowed by default.
Bind-address 127.0.0.1
This statement only allows local access. For example, if you need access from other machines, comment out this sentence #.

3. Configure phpMyAdmin

PhpMyAdmin
By default, it is not installed in/var/WWW, but in/usr/share/phpMyAdmin. You can copy phpMyAdmin.
You can create a link and copy the Link (not tried ). I personally think it is not necessary to copy it. If you do not copy the previous configuration, you do not need to change the next configuration.
Then run:
Sudo gedit/etc/PHPmyAdmin/Apache. conf
Change the path of the following two names to/var/www/phpMyAdmin
Alias/PHPmyAdmin/usr/share/phpMyAdmin
<Directory/usr/share/phpMyAdmin>
4. Modify the Apache website root directory DocumentRoot in Ubuntu
In the/etc/apache2/sites-enabled/directory, you can see a 000-Default
Open such a sentence
DocumentRoot/var/WWW
Change path
Restart the apache2 service.
Operator: Common commands

1. Restart apahce
Sudo/etc/init. d/apache2 restart
2. Restart MySQL
Sudo/etc/init. d/MySQL restart

Now, the lamp environment is configured successfully.

Installing lamp in Ubuntu has always been smooth.
Select "edit" and "mark the software package with the task group" in the new plan"
Select "lamp server"
Wait .......
Download .......
Prompt for MySQL password
Generally, it is okay to set it in the Ubuntu Chinese wiki.
Later, I reinstalled the system and configured lamp again. The problem occurs frequently... maybe it is because the previous configuration has not been cleaned up.
During this holiday, I finally set up a local server. I found some tutorials in China are different from those in other countries by referring to Ubuntu official help. I will summarize these differences:
1. Preparations
If lamp is not installed in the system, run
Code:
Sudo apt-Get update

If lamp has been installed in the system before, ensure that apache2, PhP5, and MySQL in the system are completely deleted. Search PhP5, apache2, respectively in the new software package manager, mySQL deletes the installed software package and dependency package.
You can also use the command line
Code:
Sudo apt-Get remove -- purge apache2 apache2-mpm-prefork apache2-utils
Apache2.2-common libapache2-mod-php5 libapr1 libaprutil1
Libdbd-mysql-perl libdbi-perl libmysqlclient15off Libnet-Daemon-perl
Libplrpc-perl libpq5 mysql-client-5.0 for MySQL-common mysql-Server
Mysql-server-5.0 php5-common php5-mysql
Sudo Rm-r/etc/PhP5

Run:
Code:
Sudo apt-Get autoremove
Sudo apt-Get autoclean

2. Install Lamp
You can select lamp server in the new version or install it step by step.
Code:
Sudo apt-Get install apache2
Sudo apt-Get install PhP5
Sudo apt-Get install mysql-server libapache2-mod-auth-mysql php5-mysql

3. troubleshooting
1. apache2: cocould not determine the server's fully qualified domain name, using 127.0.0.1 for servername
Code:
Sudo gedit/etc/apache2/CONF. d/FQDN

Add:
Code:
Servername localhost

Save and exit. Run the following command:
Code:
Echo "servername localhost" | sudo tee/etc/apache2/CONF. d/FQDN

Terminal display:
Code:
Servername localhost

Indicates that the setting is successful.
2. Set other folders to the local server.
In apache2, the default folder is/var/www.
This folder is owned by a Super User and cannot be written by normal users. You can modify the permissions of this folder.
Code:
Sudo chmod-r 777/var/WWW

You can also reset a folder:
Code:
Sudo CP/etc/apache2/sites-available/default/etc/apache2/sites-available/mysite

Edit configuration file
Code:
Sudo gedit/etc/apache2/sites-available/mysite

Modify the DocumentRoot in the configuration file to the new location you need, such as/home/username/www/
Replace <directory/var/www/> with <directory/home/username/www/>
Save and exit
Run:
Code:
Sudo a2dissite default & sudo a2ensite mysite

Restart apache2
Code:
Sudo/etc/init. d/apache2 restart

Enter http: // localhost in the browser
3. The php file cannot be parsed. the browser prompts you to download the PHP file to be opened.
Run:
Code:
Sudo apt-Get install libapache2-mod-php5
Sudo a2enmod PhP5

Code:
This module does not exist!

Then you need to completely delete the libapache2-mod-php5, and then reinstall it
Code:
Sudo apt-Get remove -- purge libapache2-mod-php5
Sudo apt-Get install libapache2-mod-php5

Restart apache2
Code:
Sudo/etc/init. d/apache2 restart

Clear the browser cache and enter http: localhost
4. Install phpMyAdmin
We recommend that you do not install it from the source.
Download the software package from the phpMyAdmin website and decompress it to the local directory/var/www/phpMyAdmin (/home/user/www/phpMyAdmin)
Run the following command on the terminal:
Code:
Sudo CP/var/www/PHPmyAdmin/config. sample. Inc. php/var/www/PHPmyAdmin/config. Inc. php
Sudo gedit/var/www/PHPmyAdmin/config. Inc. php

Find blowfish_secret and fill in any letter
$ Cfg ['servers'] [$ I] ['auth _ type'] = 'cooker ';
$ Cfg ['servers'] [$ I] ['host'] = 'localhost ';
$ Cfg ['servers'] [$ I] ['connect _ type'] = 'tcp ';
$ Cfg ['servers'] [$ I] ['compus'] = 'false ';
$ Cfg ['servers'] [$ I] ['extension'] = 'mysql ';
Save and exit
Install php5-mcrypt
Code:
Sudo apt-Get install php5-mcrypt

Edit the PHP configuration file
Code:
Sudo gedit/etc/PhP5/apache2/PHP. ini

Add
Code:
Extension = php5-mcrypt.so

Save and restart apache2
Enter http: // localhost/phpMyAdmin in the browser

The solution to problem 1 and 2 is not the same as the domestic tutorial.
Problem 3 and 4 are my own problems, which have been solved according to the above methods
Https://help.ubuntu.com/community/ApacheMySQLPHP?
Please add...
PS: the PDO in wiki cannot be installed in this configuration. After installation, Apache cannot be started for unknown reasons and does not know how to solve it .....

SSH
Traditional network service programs, such as FTP, pop, and telnet, are inherently insecure because they transmit passwords and data in plain text on the network, which can be easily intercepted by people with ulterior motives.
Some passwords and data. In addition, the security authentication methods of these service programs also have their weaknesses, that is, they are vulnerable to man-in-the-middle attacks. The so-called
"
The man-in-the-middle attack means that the man-in-the-middle impersonates a Real Server to receive data from you to the server, and then impersonates you to pass the data to the Real Server. The data transfer between the server and you is "intermediate"
Once you turn your hands and feet, there will be serious problems.

The full name of SSH is secure.
Shell. By using SSH, You can encrypt all transmitted data so that the "man-in-the-middle" attack method is impossible and can also prevent DNS and IP spoofing. There is another amount
The advantage is that the transmitted data is compressed, so it can speed up transmission. SSH has many functions. It can replace Telnet and provide one for FTP, pop, and even PPP.
Secure channels ".
How does SSH security authentication work?
From the client perspective, SSH provides two levels of security authentication.

Level 1 (password-based security verification) you can log on to the remote host as long as you know your account and password. All transmitted data is encrypted, but it cannot be guaranteed that the server you are connecting to is the server you want to connect. Other servers may pretend to be real servers, that is, being attacked by man-in-the-middle.

The second level (key-based security verification) depends on the key, that is, you must create a pair of keys for yourself and put the public key on the server to be accessed. If you want to connect to the SSH server,
The client software sends a request to the server and uses your key for security verification. After receiving the request, the server first finds your public key in the home directory of the server, and then sends it to you.
Public Keys. If the two keys are consistent, the server uses the public key to encrypt the challenge and send it to the client software. After the client software receives a question
Use your private key for decryption and then send it to the server.

In this way, you must know your key password. However, compared with the first level, the second level does not need to transmit passwords over the network.

The second level not only encrypts all transmitted data, but also the "man-in-the-middle" attack method is impossible (because he does not have your private key ). However, the entire logon process may take 10 seconds.

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.