FilmLooK / 用照片记录生活

爱真是不可思议!

Ubuntu 搭建Web服务器(MySQL+PHP+Apache)详细教程

Author:一爸带两霸Posted on:Category:技术狂魔No Comments

前一篇:配置远程桌面

后一篇:你好@世界!



1
.安装 rpm yum

apt install rpm
apt install yum
2.查看/管理apt的安装包
apt list
apt list --installed
3.Ubuntu 安装 MariaDB(MySQL)
sudo su
apt-get install mariadb-server-10.0 -y
apt-get install mariadb-client-10.0 -y
apt-get install libmariadb-dev-compat libmariadb-dev
apt install net-tools
sudo netstat -tap | grep mysql #检查是否安装成功
mysql -u root -p 
#-u 表示选择登陆的用户名, -p 表示登陆的用户密码,
上面命令输入之后会提示输入密码,此时输入密码就可以登录到 mysql
(默认会有一个 root 用户,密码为空)
4.Ubuntu 安装 Apache2
apt-get install apache2 -y

ping localhost #检查是否安装成功


3.apache 的默认的一些目录

默认文档根目录是在 ubuntu 上的 /var/www 目录
配置文件是 / etc/apache2/apache2.conf

配置存储在的子目录在/etc/apache2 目录

4.开启/关闭 Apache 服务器
#重启 Apache 服务器
sudo /etc/init.d/apache2 restart
#开启 Apache 服务器
sudo /etc/init.d/apache2 start
#关闭 Apache 服务器
sudo /etc/init.d/apache2 stop
5.安装PHP7.0
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php && sudo apt-get update
sudo apt-get -y install php7.2

如果之前有其他版本PHP,在这边禁用掉

sudo a2dismod php5
sudo a2enmod php7.2

安装常用扩展(建议安装)

sudo apt-get -y install php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml php7.2-intl php7.2-odbc php7.2-cgi

安装其他扩展(按需要安装)

sudo apt-get install php7.2-gd
sudo apt-get install php7.2-soap
sudo apt-get install php7.2-gmp
sudo apt-get install php7.2-pspell
sudo apt-get install php7.2-bcmath
sudo apt-get install php7.2-enchant
sudo apt-get install php7.2-imap
sudo apt-get install php7.2-ldap
sudo apt-get install php7.2-opcache
sudo apt-get install php7.2-readline
sudo apt-get install php7.2-sqlite3
sudo apt-get install php7.2-xmlrpc
sudo apt-get install php7.2-bz2
sudo apt-get install php7.2-interbase
sudo apt-get install php7.2-pgsql
sudo apt-get install php7.2-recode
sudo apt-get install php7.2-sybase
sudo apt-get install php7.2-xsl
sudo apt-get install php7.2-dba
sudo apt-get install php7.2-phpdbg
sudo apt-get install php7.2-snmp
sudo apt-get install php7.2-tidy
sudo apt-get install php7.2-zip








Tags:none

前一篇:配置远程桌面

后一篇:你好@世界!

Leave a Comment