以下安装,均在宿主机(一台配置了LAMP/LNMP的linux机器)上操作
第一步:
安装lnmp环境,建议使用centos7 yum安装,因为centos7 yum源默认支持Php5.4以上版本,避免walle系统不兼容
yum install -y mariadb mariadb-server nginx php php-bcmath php-fpm php-gd* php-json freetype freetype-devel php-mbstring php-mcrypt php-mysql php-opcache php-pdo php-pdo_dblib php-pgsql php-recode php-snmp php-soap php-xml php-pecl-zip mhash libmcrypt libmcrypt-devel
第二步:
创建walle的web目录,我把web根目录配置成/data/www/walle-web(需要配置nginx指向,后面会详述)
mkdir -p /data/www/walle-web && cd /data/www/walle-web # 新建目录
下载walle-web-master.zip并解压(下载地址:https://github.com/meolu/walle-web)
unzip walle-web-master.zip
cd walle-web-master
第三步:
设置mariadb数据库(mysql的操作一样),只需要创建数据库,建表的操作交给walle的setup.php安装程序
MariaDB [(none)]> create database walle charset=utf8mb4 collate utf8mb4_unicode_ci;
MariaDB [(none)]> grant all privileges on walle.* to 'walleuser'@'%' identified by 'wallepass';
修改walle的web连接
vim /data/www/walle-web/walle-web-master/config/local.php +14
'db' => [
'dsn' => 'mysql:host=127.0.0.1;dbname=walle', # 新建数据库walle
'username' => 'username', # 连接的用户名
'password' => 'password', # 连接的密码
],
第四步:
安装composer,如果已安装跳过
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer # PATH目录
第五步:
安装vendor
cd /data/www/walle-web/walle-web-master
composer install --prefer-dist --no-dev --optimize-autoloader -vvvv
安装速度慢或失败,可直接下载vendor解压到项目根目录(即/data/www/walle-web/walle-web-master目录下)
第六步:
初始化项目
cd /data/www/walle-web/walle-web-master
./yii walle/setup # 需要输入yes
--------------------------------------------------------------------------------------
create dir 创建目录...
mkdiring dir: /tmp/walle/
mkdiring dir: /data/www/walle-web/walle-web-master/runtime/ansible_hosts/
mkdiring dir: /data/www/walle-web/walle-web-master/vendor/bower/jquery/dist
set writable 设置可写权限...
Setting writable: /data/www/walle-web/walle-web-master/runtime
Setting writable: /data/www/walle-web/walle-web-master/web/assets
Setting writable: /tmp/walle/
Setting writable: /data/www/walle-web/walle-web-master/runtime/ansible_hosts/
set executable 设置可执行权限...
Setting executable: /data/www/walle-web/walle-web-master/yii
update database 更新数据库: yii migrate/up ...
Yii Migration Tool (based on Yii v2.0.7-dev)
省略部分输出。。。。。
*** applying m160420_015223_add_file_transmission_mode
> alter column created_at in table task to datetime COMMENT "创建时间" AFTER enable_rollback ... done (time: 0.016s)
> alter column updated_at in table task to datetime COMMENT "修改时间" AFTER created_at ... done (time: 0.052s)
> add column file_transmission_mode smallint(3) NOT NULL DEFAULT 1 COMMENT "上线文件模式: 1.全量所有文件 2.指定文件列表" AFTER branch to table task ... done (time: 0.039s)
*** applied m160420_015223_add_file_transmission_mode (time: 0.111s)
Migrated up successfully. 初始化完成
--------------------------------------------------------------------------------------
第七步:
配置nginx(刷新页面看到50x或者404均是nginx配置不当,需要查看nginx日志)
server {
listen 80;
server_name 192.168.3.13; # 改你的host
root /data/www/walle-web/walle-web-master/web; # 根目录为web
index index.php;
# 建议放内网
# allow 192.168.0.0/24;
# deny all;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}