在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

Ubuntu怎么安装Apache、PHP和MySQL

107次阅读
没有评论

共计 3699 个字符,预计需要花费 10 分钟才能阅读完成。

这篇“Ubuntu 怎么安装 Apache、PHP 和 MySQL”文章的知识点大部分人都不太理解,所以丸趣 TV 小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“Ubuntu 怎么安装 Apache、PHP 和 MySQL”文章吧。

更新操作系统

在安装之前,我们更新操作系统到最新版本,并重启云服务器。

sudo apt-get update -y
sudo apt-get upgrade -y
reboot

安装 Apache

通过以下命令安装 Apache:

sudo apt-get install apache2 -y

通过以下命令查看 Apache 的版本:

apache2 -v

显示结果如下:

Server version: Apache/2.4.29 (Ubuntu)
Server built: 2019-12-03T15:55:03

还需要设置 Apache 跟随系统启动:

sudo systemctl enable apache2.service

如果我们在浏览器上访问云服务器的 IP 地址 http://IPAddress,出现 Apache 的默认页面,就说明 Apache 已经安装成功了。

安装 PHP

通过以下命令安装 PHP:

sudo apt-get install php -y

接下来,安装必要的 PHP 扩展:

sudo apt-get install php-{bcmath,bz2,intl,gd,mbstring,mysql,fpm} -y

通过以下命令查看 PHP 的版本:

php -v

显示结果如下:

PHP 7.2.24-0ubuntu0.18.04.3 (cli) (built: Feb 11 2020 15:55:52) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
 with Zend OPcache v7.2.24-0ubuntu0.18.04.3, Copyright (c) 1999-2018, by Zend Technologies

通过以下命令查看 PHP 安装的模块:

php -m

显示结果如下:

[PHP Modules]
bcmath
calendar
ctype
fileinfo
filter
gettext
iconv
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pdo_mysql
posix
readline
Reflection
session
shmop
sockets
sodium
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
[Zend Modules]
Zend OPcache

安装 MySQL

通过以下命令安装 MySQL:

sudo apt-get install mysql-server -y

通过以下命令查看 MySQL 的版本:

mysql -V

显示结果如下:

mysql Ver 14.14 Distrib 5.7.29, for Linux (x86_64) using EditLine wrapper

然后,运行 MySQL 安装配置向导:

sudo mysql_secure_installation

在 MySQL 安装配置向导中,我们需要输入 root 密码,并回答一些安全性相关的问题,通常只需要选择向导提供的默认值即可。

Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: Y
There are three levels of password validation policy:
LOW Length  = 8
MEDIUM Length  = 8, numeric, mixed case, and special characters
STRONG Length  = 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Success.
Normally, root should only be allowed to connect from  localhost . This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
Success.
By default, MySQL comes with a database named  test  that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
 - Dropping test database...
Success.
 - Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
Success.
All done!

还需要设置 MySQL 跟随系统启动:

sudo systemctl enable mysql.service

设置 UFW

默认情况下,Ubuntu 的防火墙 UFW 是禁用状态的。我们需要启用 UFW,并允许 SSH 和 Apache 相关端口的访问。

sudo ufw allow OpenSSH
sudo ufw allow in  Apache Full 
sudo ufw enable

以上就是关于“Ubuntu 怎么安装 Apache、PHP 和 MySQL”这篇文章的内容,相信大家都有了一定的了解,希望丸趣 TV 小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注丸趣 TV 行业资讯频道。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-13发表,共计3699字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 国产欧美专区在线观看 | 青青久久久国产线免观 | 老头天天吃我奶躁我的动图 | 成人亚洲 | 主播蜜汁丝袜 精品自拍 | 67194免费毛片入口在线看 | 国产精品青青青高清在线观看 | 国内精品久久久久久久久久影视 | 国内高清久久久久久久久 | 免费国产一区二区三区 | 日韩免费无码视频一区二区三区 | 欧美亚洲另类综合 | 97视频在线观看播放 | 成人福利网站 | 国产成人看片免费视频观看 | 精品久久久中文字幕二区 | 在线欧美成人 | 久久久亚洲av波多野结衣 | 亚洲精品国产v片在线观看 亚洲精品国产不卡在线观看 | 国产三级久久精品三级 | 日本粉色视频 | 天天摸天天操天天干 | 久久国产综合尤物免费观看 | 人人妻人人插视频 | 亚洲国产精品婷婷久久久久 | 久久夜夜操妹子 | 久久精品国产亚洲夜色av网站 | 黄色毛片免费在线观看 | 四虎精品8848ys一区二区 | 亚洲国产av无码综合原创国产 | 亚洲欧美第一成人网站7777 | 精品国产三级a在线观看 | 一区二区三区日本视频 | 国产在线激情 | 国产自制一区 | 成在人线av无码免费 | 午夜网站免费版在线观看 | 青青青国产在线观看免费网站 | 国产91麻豆精品 | 成人国产精品一级毛片了 | 亚洲综合中文网 |