ubuntu配置服务器环境

今天环境不知道怎么就不能用了。自己新配了一个:

添加源:
vi /etc/apt/sources.list
将下面这些源添加进去:
deb http://debian.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse

更新源
apt-get update

1、安装数据库mysql5
apt-get install mysql-server mysql-client
安装途中会有2次提示输入root的密码

2、安装apache
apt-get install apache2

浏览器里访问:http://localhost

因为是虚拟机,我们在浏览器里输入虚拟机的IP地址
比如我的虚拟机:192.168.36.129,
我们可以看到默认页面
web目录路径:/var/www/html
配置文件:/etc/apache2/apache2.conf

====================待安装====================
3、安装php
3.1、安装php
apt-get install php5 libapache2-mod-php5

3.2、让 php5 支持 MySQL
apt-cache search php5
apt-get install php5-mysql php5-curl php5-xmlrpc php5-xsl 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-xcache

最后的php5-xcache可以不装,XCache的作用是:优化缓存
而我们的php5.5以上,已经集成了Zend OPcache

然后重启 apache2
sudo service apache2 restart

4、测试 PHP,建立一个探针文件:
vi /var/www/html/info.php
<?php
phpinfo();

5、安装phpmyadmin管理Mysql:
apt-get install phpmyadmin

在安装过程中会要求选择Web server:apache2或lighttpd,选择apache2,按tab键然后确定。然后会要求输入设置的Mysql数据库密码连接密码 Password of the database’s administrative user。
然后将phpmyadmin与apache2建立连接,以我的为例:www目录在/var/www/html,phpmyadmin在/usr/share/phpmyadmin目录,
用命令:sudo ln -s /usr/share/phpmyadmin /var/www/html 建立连接。
phpmyadmin测试:在浏览器地址栏中打开http://localhost/phpmyadmin

5.1、phpmyadmin 提示:
缺少 mcrypt 扩展。请检查 PHP 配置。
php5-mcrypt libmcrypt4 libmcrypt-dev
发现包已经都安装过了.

检查 /etc/php5/mods-available/,发现有mcrypt.ini
cd /etc/php5/apache2/conf.d
sudo ln -s ../../mods-available/mcrypt.ini 20-mcrypt.ini
sudo service apache2 restart
http://192.168.36.129/info.php
可以看到 mcrypt 加载出来了.
再打开phpmyadmin, 可以看到提示消失,问题得到解决。

转载于:https://www.cnblogs.com/chenjinxinlove/p/5218709.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值