Ubuntu Server 14.04 installation + Secure Web Server (linux + apache + mysql + php) Construction Process (update), ubuntu14.04

Source: Internet
Author: User
Tags ssh server

Ubuntu Server 14.04 installation + Secure Web Server (linux + apache + mysql + php) Construction Process (update), ubuntu14.04

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
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
/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!

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.