http://www.2cto.com/os/201505/401588.html

Ubuntu+Apache+PHP+Mysql环境搭建(完整版)

一、操作系统
Ubuntu 14.04 64位,阿里云服务器

二、Apache

1、安装Apache,安装命令:sudo apt-get install apache2

2、环境配置:

1)配置文件:路径为/etc/apache2,配置文件是apache2.conf,而没有http.conf。

2)默认网站根目录:/var/www/html,使用浏览器访问http://localhost 即可打开;

3)修改网站根目录:

A、“sudo vim /etc/apache2/apache2.conf"-->找到""的位置-->更改"/var/www/"为新的根目录“/home/www”即可

B、"sudo vi/etc/apache2/sites-available/000-default.conf"-->找到"DocumentRoot /var/www/html"的位置-->更改"/var/www/html"为新的根目录“/home/www”即可。

4)重启Apache服务器: sudo /etc/init.d/apache2 restart

三、PHP

1、更新源列表,否则安装php会失败:

命令行输入: vim /etc/apt/source.list

在最前面添加以下内容:

deb http://mirrors.aliyun.com/ubuntu/ precise main restricteduniverse multiverse

deb http://mirrors.aliyun.com/ubuntu/ precise-security mainrestricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ precise-updates mainrestricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ precise-proposed mainrestricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ precise-backports mainrestricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ precise mainrestricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ precise-securitymain restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ precise-updatesmain restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposedmain restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ precise-backportsmain restricted universe multiverse

********************************************************************************

源的版本2

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

apt-get update //更新一下列表

2、安装PHP,安装命令:sudoapt-get install php5

3、让Apache支持php,安装命令:sudo apt-get install libapache2-mod-php5

4、安装php5-gd模块,安装命令:sudoapt-get install php5-gd

5、让PHP支持curl

1)首先查看php5-curl是否已安装:dpkg -l | grep 'php5-curl'
2)如果没有安装,则:apt-get install php5-curl

3)确保 extension_dir存在,并且包含curl.so,

查找extension_dir:php -i | grep extension_dir

4)确保 /etc/php5/mods-available/curl.ini存在,文件内容如下:

; configuration for php CURL module
; priority=20
extension=curl.so

PDO已是PHP的核心,无需再安装。

只需安装php5的mysql数据库扩展php5-mysql:

sudo apt-get install php5-mysql

这样就可以使用PDO了,不需要修改php.ini。需要重启服务器。

5)如果以上步骤均确定,重启服务器。

四、Mysql

1、安装Mysql,安装命令:sudoapt-get install mysql-server,安装过程中设置密码

2、允许root远程登录:

1)从所有主机:grant all privileges on *.* to root@"%" identified by "passw0rd" with grant option;

2)can't connect to mysql server解决方法:修改配置文件,路径为/etc/mysql/my.cnf,注释掉bind-address = 127.0.0.0

即:#bind-address = 127.0.0.1

五、FTP

1、安装FTP,安装命令:sudoapt-get install vsftpd

2、查看是否安装成功:输入"sudo service vsftpdrestart"重启vsftpd服务

3、建立FTP目录: sudo mkdir/home/ftpfile/ftpfile

4、新建ftp用户: sudouseradd –d /home/ftpfile –s /bin/bash myftp

5、设置myftp用户密码: sudopasswd myftp ,输入两次密码

6、修改ftp配置文件,路径为/etc/vsftpd.conf,

1)配置修改如下:

anonymous_enable=NO

local_enable=YES

write_enable=YES

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd.chroot_list

2)在/etc/目录中新建vsftpd.chroot_list文件,添加ftp用户名:myftp。或直接:

echo “myftp” >> /etc/vsftpd.chroot_list 即可。

六、SVN

1、安装SVN,安装命令:sudo apt-get install subversion

2、创建SVN工程:sudo svnadmin create /home/svn/kyssp

3、修改svn配置: vim /home/svn/kyssp_pub/conf/svnserve.conf

anon-access = read

auth-access = write

password-db = passwd

4、设置访问用户以及密码: 编辑文件vim /home/svn/kyssp_pub/conf/passwd

在最后一行添加:用户名 = 密码

5、启动svn:svnserve -d-r /home/svn/

6、使用SVN的post-commithooks 同步推送代码到生产环境

1)进入/home/svn/kyssp/hooks目录,cp post-commit.tmpl post-commit

2)在最后,添加如下:

REPOS="$1"

REV="$2"

#TXN_NAME="$3"

WEB_PATH="/home/www/kyssp"

#"$REPOS"/hooks/mailer.py commit "$REPOS"$REV "$REPOS"/mailer.conf

#export LANG=zh_CN.UTF-8

export LANG=en_US.UTF-8

#

#svn co --username zrs --password zrs@tzuo.cnsvn://112.74.**.**/kyssp_pub /home/www/kyssp

svn update --username zrs --password zrs@tzuo.cn /home/www/kyssp

其中:

svn co --username zrs --password zrs@tzuo.cnsvn://112.74.**.**/kyssp /home/software/www/kyssp 下载工程代码

svn update --username z** --password z*** /home/software/www/kyssp 更新工程代码

Ubuntu+Apache+PHP+Mysql环境搭建(完整版)(转)的更多相关文章

  1. Ubuntu+Apache+PHP+Mysql环境搭建(完整版)

    Ubuntu+Apache+PHP+Mysql环境搭建(完整版) 一.操作系统Ubuntu 14.04 64位,阿里云服务器 二.Apache 1.安装Apache,安装命令:sudo apt-get ...

  2. Ubuntu+Apache+PHP+Mysql环境搭建

    一.操作系统Ubuntu 14.04 64位,虚拟机服务器 二.Apache 1.安装Apache,安装命令:sudo apt-get install apache2 2.环境配置: 1)配置文件:路 ...

  3. Apache+PHP+MySQL环境搭建

    准备安装包:Apache: apache_2.2.11-win32.msi (http://pan.baidu.com/s/1nvdiNcH)PHP: php-5.2.5-Win32.zip (htt ...

  4. Ubuntu下PHP MySQL环境搭建-upcoming-ChinaUnix博客

    编程语言选择php5 , web服务器选择Apache2 ,后台数据库选择MySQL首先安装编译工具, 打开终端 sudo apt-get install build-essential autoco ...

  5. Appium (win7系统)环境搭建----完整版

    首先感谢  http://www.cnblogs.com/puresoul/p/4696638.html  和 http://www.cnblogs.com/fnng/p/4540731.html   ...

  6. Appium环境搭建-完整版

    环境依赖 Node.js Appium Appium-desktop Appium-doctor Appium-Python-Client Python JDK Andriod SDK 以上所需的软件 ...

  7. Apache+php+mysql环境配置

    Apache+PHP+MySQL环境搭建 标题格式 正文格式 阶段性完成格式 正文中强调格式 ————————————————————————————— 前语:本文是从我写过的doc文档迁移过来的,由 ...

  8. Linux(Centos7)搭建LAMP(Apache+PHP+Mysql环境)

    目录 Linux搭建LAMP(Apache+PHP+Mysql环境)Centos7 一. 检查系统环境 1.确认centos版本 2.检查是否安装过apache 3.检查是否安装过Mysql 4.清理 ...

  9. 一起学ASP.NET Core 2.0学习笔记(一): CentOS下 .net core2 sdk nginx、supervisor、mysql环境搭建

    作为.neter,看到.net core 2.0的正式发布,心里是有点小激动的,迫不及待的体验了一把,发现速度确实是快了很多,其中也遇到一些小问题,所以整理了一些学习笔记: 阅读目录 环境说明 安装C ...

随机推荐

  1. UML类图解释

    那个动物矩形框,它就代表一个类(Class).类图分三层,第一层显示类的名称,如果是抽象类,则就用斜体显示.第二层是类的特性,通常是字段和属性.第三层是类的操作,通常是方法或行为.注意前面的符号,“+ ...

  2. java swing同时向jlabel添加图片和文字,并且设置文字的位置

    jLabColor.setVerticalTextPosition(JLabel.TOP);//靠上 jLabColor.setHorizontalTextPosition(JLabel.CENTER ...

  3. webpack4进阶配置

    移动端CSS px自动转换成rem 需要两步来实现: px2rem-loader 在构建阶段将px转换成rem lib-flexible 页面渲染时动态计算根元素的font-size值(手机淘宝开源库 ...

  4. P5562 [Celeste-B]Center of the Earth 题解

    构造 因为题目只要求两位相同,所以可以暴力枚举这两位所有的可能性,方案数为\(O(n^2)\). 但是,这么做是显然不优的,因为完全没有用到第三位. 观察题目条件:n为偶数. 就想一想能不能奇数偶数分 ...

  5. mybatis中使用包装对象

    在实际的应用中,很多时候我们需要的查询条件都是一个综合的查询条件,因此我们需要对已经存在的实体进行再一次的包装,以方便我们进行查询操作,于是包装对象的作用就很明显了,在这里我举一个简单的例子 1.首先 ...

  6. 模拟19 题解(waiting)

    T1,千万别转化成链了!! 直接数就可以,dfs搜索每种情况,对于搜到的点,如果子树大小过大,直接return,相等说明可以,小的话向上累加, 优化是先预处理子树大小,若子树小,不用搜了直接加上就行 ...

  7. ip地址获取无效,自己修改ip地址

    (1)

  8. JavaScript 生成32位UUID

    function uuid(){ var len=32; //32长度 var radix=16; //16进制 var chars='0123456789ABCDEFGHIJKLMNOPQRSTUV ...

  9. Python datetime模块的其他方法

  10. BZOJ 1925地精部落题解

    题目链接 一道神仙题,有很多思考的方式,这里选择最好理解的一种来讲 我们将序列分为两种,一种开头递增,一种开头递减,显然这两种序列的数目是一样的 现在我们只用考虑开头递增的情况 f[i][j]表示前i ...