跳至内容
九溪
溪水润知林,滴露启慧心
用户工具
登录
站点工具
搜索
工具
显示页面
过去修订
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您在这里:
Home
»
知识标签
»
Linux
»
Ubuntu 安装 LAMP 服务器(MySQL/PHP/Apache)
您的足迹:
wiki:linux:ubuntu-install-mysql-php-apache
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== Ubuntu 安装 LAMP 服务器(MySQL/PHP/Apache) ====== ===== 准备 ===== * 参考:[[https://blog.csdn.net/qq_40147863/article/details/83187917|Ubuntu 搭建Web服务器(MySQL+PHP+Apache)详细教程]] * 相关:[[.ubuntu-install-nginx-php-mysql]] * What is LAMP?LAMP:Linux+Apache+Mysql/MariaDB+Perl/PHP/Python ===== 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://localhost 3.apache 的默认的一些目录 - 默认文档根目录是在 ubuntu 上的 /var/www 目录 - 配置文件是 / etc/apache2/apache2.conf - 配置存储在的子目录在 /etc/apache2 目录 4.我怎么手动开启/关闭 Apache 服务器呢?(一般 Apache 服务器会自动启动) (1)重启 Apache 服务器(常用) sudo /etc/init.d/apache2 restart (2)开启 Apache 服务器 sudo /etc/init.d/apache2 start (3)关闭 Apache 服务器 sudo /etc/init.d/apache2 stop ===== 安装 php 7.0 ===== 1.这里安装比较多,也是为了以后少一些麻烦,使用命令 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 然后静静等待安装完成 因命令太多,可以使用下面,自动执行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.txt
· 最后更改: 2023/01/03 15:25 由
127.0.0.1
页面工具
显示页面
过去修订
反向链接
回到顶部