1、VMware安裝ubuntu
- 下載鏈接
桌面版:ubuntu-14.04.3-desktop-amd64.iso
服務器版:ubuntu-14.04.1-server-amd64.iso
- 安裝
這個網上有很多教程,這裏不再贅述。
2、安裝nginx
$ sudo apt-get install update
[sudo] password for elmman:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package update
$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
nginx-common nginx-core
Suggested packages:
fcgiwrap nginx-doc
The following NEW packages will be installed:
nginx nginx-common nginx-core
0 upgraded, 3 newly installed, 0 to remove and 325 not upgraded.
Need to get 349 kB of archives.
After this operation, 1,297 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main nginx-common all 1.4.6-1ubuntu3.4 [18.3 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main nginx-core amd64 1.4.6-1ubuntu3.4 [325 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main nginx all 1.4.6-1ubuntu3.4 [5,616 B]
Fetched 349 kB in 3s (111 kB/s)
Selecting previously unselected package nginx-common.
(Reading database ... 165452 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.4.6-1ubuntu3.4_all.deb ...
Unpacking nginx-common (1.4.6-1ubuntu3.4) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../nginx-core_1.4.6-1ubuntu3.4_amd64.deb ...
Unpacking nginx-core (1.4.6-1ubuntu3.4) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.4.6-1ubuntu3.4_all.deb ...
Unpacking nginx (1.4.6-1ubuntu3.4) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up nginx-common (1.4.6-1ubuntu3.4) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Setting up nginx-core (1.4.6-1ubuntu3.4) ...
Setting up nginx (1.4.6-1ubuntu3.4) ...
$
安裝完成之後:$ curl localhost
,得到如下:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
或者訪問:http://localhost/
3、安裝MySQL
$ sudo apt-get install mysql-server mysql-client
#一路y下去,直到配置密碼
#密碼別忘了~~~
$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
4、安裝PHP
$ apt-get install php5-fpm php5-mysql php5-curl php5-dev 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
5、安裝基本工具
$ sudo apt-get install vim
....
$
6、配置運行環境
$ cd /etc/nginx/sites-enabled/
/etc/nginx/sites-enabled $ sudo vim test.conf
#test.conf
server {
listen 80;
root /home/elmman/test;
index index.html index.htm index.php;
server_name test.elmman.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
#重啓nginx
$ sudo nginx -s reload
#配置hosts
$ sudo vim /etc/hosts
#hosts
#在ipv4列表里加上127.0.0.1 test.elmman.com
127.0.0.1 localhost
127.0.1.1 ubuntu
127.0.0.1 test.elmman.com
$
7、測試基本運行環境
$ cd ~/test
~/test $ vim phpinfo.php
<?php
echo "Hello World!";
phpinfo();
$
然後訪問瀏覽器: http://test.elmman.com/phpinfo.php
8、安裝redis
$ sudo apt-get install redis-server redis-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libjemalloc1
The following NEW packages will be installed:
libjemalloc1 redis-server redis-tools
0 upgraded, 3 newly installed, 0 to remove and 325 not upgraded.
Need to get 410 kB of archives.
After this operation, 1,272 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
WARNING: The following packages cannot be authenticated!
libjemalloc1 redis-tools redis-server
Install these packages without verification? [y/N] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libjemalloc1 amd64 3.5.1-2 [76.8 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/universe redis-tools amd64 2:2.8.4-2 [65.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/universe redis-server amd64 2:2.8.4-2 [267 kB]
Fetched 410 kB in 14s (28.6 kB/s)
Selecting previously unselected package libjemalloc1.
(Reading database ... 169544 files and directories currently installed.)
Preparing to unpack .../libjemalloc1_3.5.1-2_amd64.deb ...
Unpacking libjemalloc1 (3.5.1-2) ...
Selecting previously unselected package redis-tools.
Preparing to unpack .../redis-tools_2%3a2.8.4-2_amd64.deb ...
Unpacking redis-tools (2:2.8.4-2) ...
Selecting previously unselected package redis-server.
Preparing to unpack .../redis-server_2%3a2.8.4-2_amd64.deb ...
Unpacking redis-server (2:2.8.4-2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up libjemalloc1 (3.5.1-2) ...
Setting up redis-tools (2:2.8.4-2) ...
Setting up redis-server (2:2.8.4-2) ...
Starting redis-server: redis-server.
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ureadahead (0.100.0-16) ...
$ redis-cli
127.0.0.1:6379>