1、拉取一个ubuntu镜像
docker pull ubuntu:16.04
2、更新apt-get
apt-get update
apt-get -y upgrade
3、安装apache2
apt-get -y install apache2
apache2的操作
/etc/init.d/apache2 [start | stop | restart | status]
4、安装PHP及相关模块
apt-get -y install php php-gd php-mbstring php-common php-mysql libapache2-mod-php php-curl php-xml
5、安装MySQL
apt-get -y install mysql-server
- mysql 相关操作
/etc/init.d/mysql [start | stop | restart | status]
- mysql错误日志
mysql错误日志文件/var/log/mysql/error.log
6、启动Apache2
echo "ServerName IP" >> /etc/apache2/apache2.conf
/etc/init.d/apache2 restart
7、启动MySQL
/etc/init.d/mysql start
8、进入mysql,执行创建mysql数据库和数据库用户语句
CREATE DATABASE backdrop_db CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'User&123456';
GRANT ALL PRIVILEGES ON backdrop_db.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
9、进入到项目目录
cd /var/www/html
10、下载backdropcms源码
wget https://github.com/backdrop/backdrop/releases/download/1.8.0/backdrop.zip
11、解压
mv ./backdrop/* /var/www/html
12、修改文件属性
chown -R www-data:www-data *
13、重启apache
/etc/init.d/apache2 restart
14、 修改项目的配置项中mysql相关配置
vim /var/www/html/settings.php
编辑$database = 'mysql://user:pass@localhost/database_name';
$database = 'mysql://user:User&123456@localhost/backdrop_db';
15、web登入到cms服务
浏览器输入ip
16、配置超级管理员信息
报错处理
- mysql启动报错 No directory, logging in with HOME=/
处理:
usermod -d /var/lib/mysql/ mysql
/etc/init.d/mysql start```
网友评论