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. 微信小程序滚动到某个位置添加class效果。

    <scroll-view scroll-y="true" style="height:100vh;" bindscrolltoupper="up ...

  2. 我的常用vs code 插件

    换了台电脑重新装上了VS CODE,但是用起来后发现非常不顺手,突然醒悟原来还没有装上插件. 正动手装插件,但又一脸茫然了,我以前都装了些什么插件来着?因为平时根本不会去几插件的名字啊,只能靠搜搜一些 ...

  3. Mybatis insert返回主键ID

    Mybatis insert语句书写 <insert id="insertSelective" useGeneratedKeys="true" keyPr ...

  4. spring四种依赖注入方式(转)

    spring四种依赖注入方式!! 平常的java开发中,程序员在某个类中需要依赖其它类的方法,则通常是new一个依赖类再调用类实例的方法,这种开发存在的问题是new的类实例不好统一管理,spring提 ...

  5. python基础(输出、变量、常量、数据类型、流程控制)

    输出 print print("Hello World!") # python2 和 python3 的区别 # python2 # coding:utf-8 print 123 ...

  6. 项目中的那些事---Java反射的应用

    最近工作中遇到一个这样的问题: 为某个项目中的所有接口做一个测试工具,使用java Swing技术,该项目有不同的版本,不是所有版本中的接口都是相同的,而我做的工具需要兼容所有版本. 于是就引入了这样 ...

  7. thinkcmf 导航高亮制作方法(适用于多级导航)(通用)

    平时用thinkcmf网站开发经常需要导航点击之后高亮,就写了一些实现方法分享一下. 思路很简单,先获取当前页面的顶级栏目的地址,然后与导航中的地址比较,相同的就加上一个class,把下面函数理解了不 ...

  8. 阿里云MaxCompute 2019-7月刊

    您好,MaxCompute 2019.7月刊为您带来7月产品.技术最新动态,欢迎阅读. 导读 [发布]7月产品重要发布 [资讯]7月重要资讯 [文档]7月重要文档更新推荐 [干货]7月精选技术文章推荐 ...

  9. Data Visualisation Cheet Sheet

    Univariate plotting with pandas import pandas as pd reviews = pd.read_csv() reviews.head() //bar rev ...

  10. nested exception is org.hibernate.MappingException解决方案

    1.可能是因为映射文件( Order.hbm.xm)配置的class路径出错 <hibernate-mapping> <class name="com.web.bean.O ...