wiki:linux:ubuntu-install-mysql-php-apache
差别
这里会显示出您选择的修订版和当前版本之间的差别。
后一修订版 | 前一修订版 | ||
wiki:linux:ubuntu-install-mysql-php-apache [2019/09/23 16:14] – 创建 colin | wiki:linux:ubuntu-install-mysql-php-apache [2023/01/03 15:25] (当前版本) – 外部编辑 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Ubuntu | + | ====== Ubuntu |
- | 参考:[[https:// | + | ===== 准备 ===== |
+ | |||
+ | * 参考:[[https:// | ||
+ | * 相关:[[.ubuntu-install-nginx-php-mysql]] | ||
+ | * What is LAMP?LAMP:Linux+Apache+Mysql/ | ||
+ | |||
+ | ===== Ubuntu 安装 MySQL ===== | ||
+ | |||
+ | 1.打开 Ubuntu 终端,使用下面命令进入管理员权限 | ||
+ | sudo su | ||
+ | |||
+ | 输入系统的密码 | ||
+ | |||
+ | 2.Ubuntu 上安装 mysql 非常简单只需要几条命令就可以完成 | ||
+ | apt-get install mysql-server | ||
+ | apt-get install mysql-client | ||
+ | apt-get install libmysqlclient-dev | ||
+ | |||
+ | 执行命令时会提示输入 Y 表示同意 | ||
+ | |||
+ | 3.Ubuntu 安装 net-tools | ||
+ | apt install net-tools | ||
+ | |||
+ | 4.检查是否安装成功 | ||
+ | sudo netstat -tap | grep mysql | ||
+ | |||
+ | 如果看到有 mysql 的socket处于 listen 状态则表示安装成功 | ||
+ | |||
+ | 5.登陆mysql数据库可以通过如下命令: | ||
+ | mysql -u root -p | ||
+ | |||
+ | -u 表示选择登陆的用户名, -p 表示登陆的用户密码,上面命令输入之后会提示输入密码,此时输入密码就可以登录到 mysql | ||
+ | (默认会有一个 root 用户,密码也为:root) | ||
+ | |||
+ | 6.然后就可以查看当前的数据库 | ||
+ | show databases; | ||
+ | |||
+ | 7.然后就是 MySQL 的一些操作了 | ||
+ | |||
+ | 分享 MySQL 常用命令:MySQL 常用命令大全 | ||
+ | |||
+ | ===== Ubuntu 安装 Apache2 ===== | ||
+ | |||
+ | 1.Ubuntu 安装 Apache2 | ||
+ | apt-get install apache2 | ||
+ | |||
+ | 输入 Y 同意 | ||
+ | |||
+ | 2.检查是否安装成功,在浏览器输入地址:http:// | ||
+ | |||
+ | 3.apache 的默认的一些目录 | ||
+ | |||
+ | - 默认文档根目录是在 ubuntu 上的 /var/www 目录 | ||
+ | - 配置文件是 / etc/ | ||
+ | - 配置存储在的子目录在 / | ||
+ | |||
+ | 4.我怎么手动开启/ | ||
+ | |||
+ | (1)重启 Apache 服务器(常用) | ||
+ | sudo / | ||
+ | |||
+ | (2)开启 Apache 服务器 | ||
+ | sudo / | ||
+ | |||
+ | (3)关闭 Apache 服务器 | ||
+ | sudo / | ||
+ | |||
+ | ===== 安装 php 7.0 ===== | ||
+ | |||
+ | 1.这里安装比较多,也是为了以后少一些麻烦,使用命令 | ||
+ | sudo apt-get install software-properties-common | ||
+ | sudo add-apt-repository ppa: | ||
+ | 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 | ||
+ | |||
+ | # 安装其他扩展(按需要安装) | ||
+ | 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 | ||
+ | |||
+ | 然后静静等待安装完成 | ||
+ | |||
+ | 因命令太多,可以使用下面,自动执行y | ||
+ | |||
+ | yes|sudo apt-get install php7.2-gd | ||
+ | yes|sudo apt-get install php7.2-soap | ||
+ | yes|sudo apt-get install php7.2-gmp | ||
+ | yes|sudo apt-get install php7.2-pspell | ||
+ | yes|sudo apt-get install php7.2-bcmath | ||
+ | yes|sudo apt-get install php7.2-enchant | ||
+ | yes|sudo apt-get install php7.2-imap | ||
+ | yes|sudo apt-get install php7.2-ldap | ||
+ | yes|sudo apt-get install php7.2-opcache | ||
+ | yes|sudo apt-get install php7.2-readline | ||
+ | yes|sudo apt-get install php7.2-sqlite3 | ||
+ | yes|sudo apt-get install php7.2-xmlrpc | ||
+ | yes|sudo apt-get install php7.2-bz2 | ||
+ | yes|sudo apt-get install php7.2-interbase | ||
+ | yes|sudo apt-get install php7.2-pgsql | ||
+ | yes|sudo apt-get install php7.2-recode | ||
+ | yes|sudo apt-get install php7.2-sybase | ||
+ | yes|sudo apt-get install php7.2-xsl | ||
+ | yes|sudo apt-get install php7.2-dba | ||
+ | yes|sudo apt-get install php7.2-phpdbg | ||
+ | yes|sudo apt-get install php7.2-snmp | ||
+ | yes|sudo apt-get install php7.2-tidy | ||
+ | yes|sudo apt-get install php7.2-zip |
wiki/linux/ubuntu-install-mysql-php-apache.1569226456.txt.gz · 最后更改: 2023/01/03 15:24 (外部编辑)