Ubuntu16.04 搭建LAMP环境
来源:互联网 发布:unity3d寻路 提示路线 编辑:程序博客网 时间:2024/05/16 08:55
更新
sudo apt-get update
完成
Fetched 35.8 MB in 8s (4,233 kB/s) Reading package lists... Done
安装Apache2
sudo apt-get install apache2
完成
Processing triggers for libc-bin (2.23-0ubuntu9) ...Processing triggers for systemd (229-4ubuntu18) ...Processing triggers for ureadahead (0.100.0-19) ...Processing triggers for ufw (0.35-0ubuntu2) ...
输入命令 apachectl -v
可以看到当前apache版本
Server version: Apache/2.4.18 (Ubuntu)Server built: 2017-07-27T14:34:01
访问服务器IP , 出现It works! 则表示安装成功
安装MySql
sudo apt-get install mysql-server mysql-client
安装完成
Processing triggers for libc-bin (2.23-0ubuntu9) ...Processing triggers for systemd (229-4ubuntu18) ...Processing triggers for ureadahead (0.100.0-19) ...
尝试登陆下数据库 输入命令mysql -u root -p
输入密码之后按回车
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 5Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
安装PHP
sudo apt-get install php
安装完成
Creating config file /etc/php/7.0/fpm/php.ini with new versionSetting up php7.0 (7.0.22-0ubuntu0.16.04.1) ...Setting up php (1:7.0+35ubuntu6) ...Processing triggers for systemd (229-4ubuntu18) ...Processing triggers for ureadahead (0.100.0-19) ...
输入命令 php -v
可以看到PHP的版本
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )Copyright (c) 1997-2017 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
安装其他模块
sudo apt-get install libapache2-mode-phpsudo apt-get install php-mysql
重启服务
sudo service mysql restartsudo service apache2 restart
测试
创建一个文件
vim /var/www/html/phpinfo.php
内容为
<?php echo phpinfo(); ?>
浏览器访问http://ip地址/phpinfo.php
修改权限
/var/www sudo chomod 777 /var/www
安装phpMyAdmin
sudo apt-get install phpmyadmin
Processing triggers for libc-bin (2.23-0ubuntu9) ...Processing triggers for libapache2-mod-php7.0 (7.0.22-0ubuntu0.16.04.1) ...Processing triggers for php7.0-fpm (7.0.22-0ubuntu0.16.04.1) ...
创建快捷方式
sudo ln -s /usr/share/phpmyadmin /var/www/html
启用Apache mod_rewrite模块
sudo a2enmod rewrite
重启服务
sudo service php7.0-fpm restartsudo service apache2 restart
访问浏览器 http://ip地址/phpmyadmin
sudo时出现sudo: unable to resolve host xxxx
执行sudo时发现会出警告
sudo: unable to resolve host
解决办法
vim /etc/hosts
原始内容为
127.0.0.1 localhost# The following lines are desirable for IPv6 capable hosts::1 localhost ip6-localhost ip6-loopbackff02::1 ip6-allnodesff02::2 ip6-allrouters
在127.0.0.1 localhost后加上当前主机名称即可 , 如127.0.0.1 localhost xxxx
阅读全文
1 0
- Ubuntu16.04 搭建LAMP环境
- Ubuntu16.04下LAMP环境搭建
- Ubuntu16.04搭建LAMP环境详细教程
- Ubuntu16.04下搭建LAMP环境
- ubuntu16.04 搭建LAMP环境(为laravel做准备)
- LAMP环境搭建(ubuntu16.04+apache2.4.8+maria10.0.27+php7)
- ubuntu16.04搭建LAMP环境以及遇到的问题
- ubuntu16.04搭建lamp环境(Apache2+PHP7.0+MySQL5.7)
- Ubuntu16.04从零搭建lamp环境,再到跑通laravel项目
- LAMP搭建环境 ubuntu16.04 apache7 + mysql+ phpmyadmin
- Ubuntu16.04安装LAMP环境
- Ubuntu16.04配置LAMP环境
- ubuntu16.04配置Lamp环境
- ubuntu16.04配置Lamp环境(搭建linux+apache+mysql+php7环境
- ubuntu16.04配置Lamp环境(搭建linux+apache+mysql+php7环境)
- ubuntu16.04配置Lamp环境(搭建linux+apache+mysql+php7环境
- ubuntu16.04配置Lamp环境(搭建linux+apache+mysql+php7环境)
- Ubuntu16.04环境搭建
- ZOJ 3449 Doraemon's Number Game III
- Day22
- 函数详解(function)--shell学习
- acm
- 单例模式
- Ubuntu16.04 搭建LAMP环境
- 不写博客浑身难受
- 设计模式8——观察者模式
- iOS Xcode启动模拟器之后电脑卡顿的原因
- 逻辑回归(logistic regression)的本质——极大似然估计
- 牛客网华为在线训练---明明的随机数
- hdu 2066 一个人的旅行(Dijkstra)
- 关于const
- Day23