UbuntuServer14.04 Install Web Server (Linux + Apache + MySQL + PHP)

Source: Internet
Author: User
Tags ssh server
After CentOS and Ubuntu, we found that Ubuntu is much simpler ~~ I don't know what the performance is like. Taking Ubtuntu14.04 as an example, record the building process. 1. Installation notes 1. do not plug in the network cable when installing the IP address. Otherwise, DHCP will occur, which may be difficult to configure later. the automatic partitions of Hard Disk Partitions seem to include:/, swap, efiswap, And/boot (200 MB). The actual two partitions are sufficient: swap is the memory of 1 ~ 2 times the size, and all remaining values are/

After CentOS and Ubuntu, we found that Ubuntu is much simpler ~~ I don't know what the performance is like.

Taking Ubtuntu 14.04 as an example, record the building process.

1. Installation notes 1. IP Address

Do not plug in the network cable before installation. Otherwise, DHCP may occur, which may be difficult to configure later.

2. Hard Disk partitioning

Automatic partitioning may look like:/, swap, efiswap,/boot (200 MB)
The actual two zones are sufficient: swap is 1 ~ of the memory ~ 2 times the size, and all remaining values are/

Ii. IP configuration

Generally, after installation, You need to configure an ip address for remote connection. The following is a multi-ip configuration. (An IP address is configured as a wizard during installation. You only need to copy and paste the IP address during modification)

vi /etc/network/interfaces

Configuration information:

 # The primary network interface auto em0 iface em0 inet static         address 192.168.1.1         netmask 255.255.252.0         network 192.168.1.0         broadcast 192.168.1.255         gateway 192.168.8.254         # dns-* options are implemented by the resolvconf package, if installed         dns-nameservers 8.8.8.8 8.8.8.9         # dns-search 163.com # The second network interface auto em1 iface em1 inet static         address 192.168.1.2         netmask 255.255.252.0         network 192.168.1.0

Restart the NIC (it does not necessarily take effect, reboot is certainly acceptable)

/etc/init.d/networking restart
Iii. SSH Server

After the default installation, modify the configuration file vi/etc/ssh/sshd_config.
For security reasons, you can create an allowed list:

1. Modify/etc/hosts. allow:
sshd: 192.168.1. , 192.168.0. : allow
2. Modify/etc/hosts. deny:
sshd : ALL
Iv. system updates

First, update the source to use Trusty Tahr (14.04) as an example. For other versions, see the configuration generator.

deb http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiversedeb http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiversedeb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse

Update apt-get again

apt-get updatesudo apt-get upgrade

Then update the system and restart it.

sudo apt-get install update
5. install network neighbors in Samba
  1. Apt-get install samba is installed by default.
  2. Create an existing user somebody for the ubuntu System for samba:
smbpasswd -a somebody

Then you will be prompted to enter the password, which is the password for accessing the folder of the neighbor on the network.
3. modify the configuration file:

cp /etc/samba/smb.conf /etc/samba/smb.conf.bakvi /etc/samba/smb.conf

Add a shared directory after the directory:

[share]    path = /home/somebody/samba_share      available = yes       browseable = yes       public = no       writable = yes
  1. Restart samba to access it like windows
/etc/init.d/samba restart 
6. Install apache2
apt-get install apache2  

After installation, access http: // localhost to see "It Works !"
The apache2 configuration file is in/etc/apache2/apache2.conf, and the web directory is in/var/www/html.

The default user is www-data, which is defined in the./envvars file.

Other configuration files are:./sites-enabled/*. conf

7. Install mysql
apt-get install mysql-server mysql-client

The root password must be set during the installation process. In Ubuntu, the MySQL configuration information is in the/etc/mysql directory.

The default Character Set of MySQL is latin1:

To avoid possible garbled characters in Chinese, change the default character set to UTF-8. For details, refer to this article to modify the/etc/mysql/my. cnf file and add it in the corresponding location:

[client]default-character-set=utf8[mysql]default-character-set=utf8[mysqld]collation-server = utf8_unicode_ciinit-connect='SET NAMES utf8'character-set-server = utf8

The modification is as follows:

8. Install php5 and Apache php5 modules
apt-get install php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl 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

OK! It Works!

------------------------------------ Split line ------------------------------------

CentOS 6.5 system installation configuration LAMP (Apache + PHP5 + MySQL) server environment http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 configure LAMP + phpMyAdmin PHP (5.5.9) Development Environment http://www.linuxidc.com/Linux/2014-10/107924.htm

Windows 7 hard drive installation Ubuntu 14.10 graphic tutorial http://www.linuxidc.com/Linux/2014-10/108430.htm

Ubuntu 14.10 http://www.linuxidc.com/Linux/2014-10/108402.htm U disk installation

Ubuntu 14.10 official release download http://www.linuxidc.com/Linux/2014-10/108363.htm

How to upgrade Ubuntu 14.04 LTS to Ubuntu 14.10 http://www.linuxidc.com/Linux/2014-10/108381.htm

Ubuntu 14.10 install LAMP service graphic details http://www.linuxidc.com/Linux/2014-12/110082.htm

------------------------------------ Split line ------------------------------------

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-06/119061.htm

Related Article

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.