Https://github.com/zhblue/hustoj
Preparatory work:
Http://www.java123.net/v/961634.html
1, first open the command line, switch to root identity, to obtain the latest package
Su Root
sudo apt-get install update
2. Install MySQL Database
sudo apt-get install mysql-server mysql-client
Enter the database password for prompt, then enter, then the prompt, repeat the input again, then enter
Finally installs the backward database test whether installs successfully, sees the welcome message to be OK
Mysql-uroot-p
3. Install Apache Server
sudo apt-get install Apache2
Test after installation, enter http://localhost/or HTTP://127.0.0.1/in the browser
4, install PHP, and let Apache support PHP
sudo apt-get install php5 libapache2-mod-php5
Restart Apache server after installation is complete
Sudo/etc/init.d/apache2 restart
In the new terminal input
sudo nautilus
Then go to Apache's www folder (default in/Var)
Create a phpinfo.php file
and write it in the phpinfo.php file.
<?phpphpinfo ();? >
Finally, enter http://localhost/phpinfo.php in the browser, you can see the information of PHP
However, it is not possible to connect to the database, and the corresponding modules are not installed, then see the 5th step
5. Installed Php-mysql package and some other common modules
sudo 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
Then visit http://localhost/phpinfo.php again (it's a good idea to restart Apache first)
6, Installation phpMyAdmin
We can easily manage our MySQL database with phpMyAdmin.
sudo apt-get install phpMyAdmin
The following choices appear during installation, asking if you want to configure phpMyAdmin, we select "YES"
Then you need to enter the MySQL password until the installation is complete.
Since the installation path for phpMyAdmin is/usr/share/phpmyadmin/by default, we move the phpMyAdmin to the/var/www/directory:
sudo mv/usr/share/phpmyadmin/var/www
Then http://localhost/phpmyadmin access, to the phpMyAdmin landing interface.
3. Change the default directory of Apache2 to the current development directory
The default directory for APACHE2 is configured in the/etc/apache2/sites-enabled/00default file. Locate the DocumentRoot entry in the file, and change the/var/www to your development directory for OK. Of course, there is another way is not the default directory, just create a link to your directory under Var/www. For example your directory in/home/username/phptest, then you just sudo ln-s/home/username/phptest/var/www/phptest so you can pass http://localhost/ Phptest has access to your working directory. [note] The link file name cannot contain ".", otherwise apache2 will attempt to parse it as a file and cannot reach the effect of the linked directory. Personal referrals are made in the latter way, so that multiple working directories can be developed in parallel. Common commands in configuration restart Apache sudo/etc/init.d/apache2 restart
Ubuntu Installation Hustoj