Read a lot of online on the Linux operating system to build a Web server tutorial, so I myself also tested a lot, but today tested Ubuntu 12.04 Build Web Site Server (mysql+php+apache environment), feel this suitable for beginners. So here's to share with you. In fact, this online also has a tutorial, but I am here to optimize the predecessors of the tutorial, because I was in accordance with their operation when the card several times, because they have not been clear in some places.
Ubuntu 12.04 (codenamed Precise Pangolin) is an lts long-term support version that has been officially released. Ubuntu 12.04 is the 16th generation of Ubuntu, and as a long-supported version its life cycle is 5 years.
Ubuntu 12.04 uses the Linux kernel 3.2 and GNOME 3.4 desktop environments, and integrates the Unity interface. Ubuntu 12.04 main components/features include: Unity 3D interface 5.10; Unity 2D Interface 5.10; GNOME 3.4.1; Linux kernel 3.2.12; X.Org 7.6; Xorg Server 1.11.4; Upstart 1.5; GCC 4.6.3 Toolchain; Python 2.7.3 and Python 3.2.3; Compiz Fusion 0.9.7.6.
Ubuntu 12.04 includes the following versions: Ubuntu Desktop, ubuntu Server, Ubuntu Cloud Server, Ubuntu Netboot, Ubuntu Core, Ubuntu Studio, Edubuntu, Kubuntu, Xubuntu, Lubuntu, Mythbuntu.
1. Start the description
Many of the following may be referred to the Internet as a predecessor, but some improvements. These settings may vary, and you will need to modify them according to different circumstances.
Installing Apache2
2. Switch Administrator status
You need to use root in Ubuntu, so make sure to log in as root with the following command:
sudo su
3. Start the installation of MYSQL5
Apt-get Install Mysql-server mysql-client
You will be asked to provide a password for the root user of MySQL and we need to set the password in the red zone.
New password for the MySQL root user:repeat password for the MySQL root user:
4. Installing Apache2
Apache2 is a software package for Ubuntu, so we can install it directly with the following command:
Apt-get Install Apache2
Now, your browser to http://localhost, you should see the APACHE2 test page:
If it goes well, it will appear:
It worke!
And then a little later.
The default document root directory for Apache is the/var/www directory on Ubuntu and the config file is/etc/apache2/apache2.conf. Configure the subdirectories stored in the/etc/apache2 directory.
Installing PHP5
5. Installing PHP5
We can install the PHP5 and Apache PHP5 modules directly, as follows:
Apt-get Install PHP5 LIBAPACHE2-MOD-PHP5
Restart required after installation
/etc/init.d/apache2 restart
6. Test the PHP5 and get php5 installation of Detailed Letter Interest
The default Web site's file root directory is under/var/www. Now we will create a small php file (info.php) in the directory to invoke it in the browser. The file will display a lot about our PHP installation, such as the installed PHP version and some useful details.
vi/var/www/info.php
Here is the explanation, if the command line operation is not possible (of course, since you should be accustomed to using Linux to learn to use the command line). Can be set up manually, that is, in the system file/var/www/under the establishment of the file info.php, written inside
<?phpphpinfo ()?>
Here is the following: It is also my problem, I started to install the Ubuntu 12.04, I found here I do not have permission to operate, although the root authority has been obtained, here to tell you,
How should we set the read and write permissions for the file and file directories?
Everyone knows, we use the virtual host know set 777 what, in fact, here is the same, there are many ways to use, I will tell one of them.
Here we use chmod, for example we want to set up our WWW directory read and write, is chmod 777/var/www/. Specifically, we can refer to the use of the Baidu Encyclopedia command
Http://baike.baidu.com/view/1229012.htm.
Now we can use a browser to access such as http://localhost/info.php
As you can see, php5 works properly, it passes the Apache 2.0 handler in the Server API line. If you continue scrolling down, you will see all the modules that have been enabled in PHP5. MySQL is not listed, which means we do not support MySQL in PHP5.
PHP5 to get MySQL support
7.PHP5 to get MySQL support
Let PHP get support in MySQL, we can install the Php-mysql package. It is a good idea to install some other PHP5 modules, as well as the applications you may need:
Apt-cache Search PHP5
Also installs the required installation
Apt-get Install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming Php5-ps Php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Now restart the apache2:
/etc/init.d/apache2 restart
Now, reload the http://localhost/info.php in your browser and scroll down to the module section again. Now you should find many new modules, including the MySQL module:
Installing phpMyAdmin
8. Installing phpMyAdmin
phpMyAdmin is a network interface through which you can manage your MySQL database.
Apt-get Install phpMyAdmin
At this time I have to correct the shortcomings of the predecessor, he did not speak clearly here. This should be: automatically installed under the/usr/share/phpmyadmin, and then copy the phpMyAdmin to/var/www directory, run http://localhost/phpmyadmin/can
Note that the above user name is root, password is everyone in front of the database password set!
All right, now we're finished!
Contributions from: http://mgzyxz.com/blog/165.html, reprint to be noted.
Ubuntu 12.04 Build Web Server (Mysql+php+apache) (GO)