Centos7安装Redmin+Nginx

Centos 7的设定

  1. 修改SELinux

vim /etc/sysconfig/selinux

this file controls the state of SELinux on the system.

SELINUX= can take one of these three values:

enforcing - SELinux security policy is enforced.

permissive - SELinux prints warnings instead of enforcing.

disabled - No SELinux policy is loaded.

SELINUX=disabled

SELINUXTYPE= can take one of three two values:

targeted - Targeted processes are protected,

minimum - Modification of targeted policy. Only selected processes are prote cted.

mls - Multi Level Security protection.

SELINUXTYPE=targeted

重启生效

reboot -p

  1. 开启防火墙:
    systemctl start firewalld

systemctl stop firewalld

配置 3000端口(后续安装要用到):

firewall-cmd –zone=public –add-port=80/tcp –permanent

firewall-cmd –zone=public –add-port=3000/tcp –permanent
firewall-cmd –zone=public –add-service=http –permanent
firewall-cmd –reload
firewall-cmd –list-all

检查以下软件是否安装:
rpm -qa|grep MariaDB
rpm -qa|grep Passenger
rpm -qa|grep ruby
rpm -qa|grep httpd
rpm -qa|grep mysql

安装必要的软件包
1. 开发工具的安装
yum -y groupinstall “Development Tools”

  1. Ruby和Passenger的必要文件
    yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel

  2. 安装MariaDB数据库
    yum -y install mariadb-server mariadb-devel

  3. 安装图片支持包
    yum -y install ImageMagick ImageMagick-devel

安装Ruby2.2

cd ..
cd usr/local

  1. 下载源码(centos 7自带的ruby rmp包为2.0)
    curl -O https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz

  2. 安装

tar xvf ruby-2.2.2.tar.gz
cd ruby-2.2.2
./configure –disable-install-doc
make
make install
cd ..

  1. 安装bundle

将ruby源修改为淘宝源

gem sources –add https://ruby.taobao.org/ –remove https://rubygems.org/
gem sources -l

安装

gem install bundler –no-rdoc –no-ri

MariaDB设置

  1. 设置utf8
    vim /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

symbolic-links=0

Settings user and group are ignored when systemd is used.

If you need to run mysqld under a different user or group,

customize your systemd unit file for mariadb according to the

instructions in http://fedoraproject.org/wiki/Systemd

character-set-server=utf8

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#

include all files from the config directory

#
!includedir /etc/my.cnf.d
[mysql]
default-character-set=utf8

  1. 设置开机启动
    systemctl start mariadb.service
    systemctl enable mariadb.service

  2. 设置root密码

Pwd:Dfss@456

在Root目录下,执行命令:
mysql_secure_installation

  1. #在下面输出中,进行操作
  2. In order to log into MariaDB to secure it, we’ll need the current
  3. password for the root user. If you’ve just installed MariaDB, and
  4. you haven’t set the root password yet, the password will be blank,
  5. so you should just press enter here.
  6. Enter current password for root (enter for none): #直接回车
  7. OK, successfully used password, moving on…
  8. Setting the root password ensures that nobody can log into the MariaDB
  9. root user without the proper authorisation.
  10. Set root password? [Y/n] y
  11. New password: #输入新的密码
  12. Re-enter new password: #再次输入密码
  13. Password updated successfully!
  14. Reloading privilege tables..
  15. … Success!
  16. By default, a MariaDB installation has an anonymous user, allowing anyone
  17. to log into MariaDB without having to have a user account created for
  18. them. This is intended only for testing, and to make the installation
  19. go a bit smoother. You should remove them before moving into a
  20. production environment.
  21. Remove anonymous users? [Y/n] y
  22. … Success!
  23. Normally, root should only be allowed to connect from ‘localhost’. This
  24. ensures that someone cannot guess at the root password from the network.
  25. Disallow root login remotely? [Y/n] n
  26. … Success!
  27. By default, MariaDB comes with a database named ‘test’ that anyone can
  28. access. This is also intended only for testing, and should be removed
  29. before moving into a production environment.
  30. Remove test database and access to it? [Y/n] y
  31. Reloading the privilege tables will ensure that all changes made so far
  32. will take effect immediately.
  33. Reload privilege tables now? [Y/n] y
  34. … Success!
  35. Cleaning up…
  36. All done! If you’ve completed all of the above steps, your MariaDB
  37. installation should now be secure.
  38. Thanks for using MariaDB!

  39. 设置redmine的数据库
    mysql -uroot -p
    MariaDB [(none)]> create database db_redmine default character set utf8;
    MariaDB [(none)]> grant all on db_redmine.* to user_redmine@localhost identified by ‘**‘;
    MariaDB [(none)]> flush privileges;
    MariaDB [(none)]> \q

Remine配置安装
1. 下载

cd usr/local
yum -y install wget
wget http://www.redmine.org/releases/redmine-3.2.6.tar.gz

  1. 连接设置

tar -zxvf redmine-3.2.6.tar.gz

cd redmine-3.2.6

修改数据库配置文件

cp config/database.yml.example config/database.yml
vim config/database.yml

修改production选项

production:
adapter: mysql2
database: db_redmine
host: localhost
username: user_redmine
password: “**
encoding: utf8

  1. 安装gem的依赖

修改ruby源

cd /usr/local/redmine-3.2.6
vim Gemfile

修改第一行为:

source ‘https://ruby.taobao.org/

安装依赖

bundle install –without development test –path vendor/bundle

  1. 管理平台初始设置

mysql -u user_redmine -p
输入:**

创建会话防止篡改私钥

bundle exec rake generate_secret_token

创建数据库的表

bundle exec rake db:migrate RAILS_ENV=production

默认数据登记

RAILS_ENV=production REDMINE_LANG=zh bundle exec rake redmine:load_default_data

Passenger安装

安装用于运行Redis的应用程序

gem install passenger –no-rdoc –no-ri

文件权限:
mkdir -p tmp tmp/pdf public/plugin_assets
sudo chown -R root files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

测试安装运行WEBrick web服务器:
bundle exec rails server webrick -e production

添加 -b 0.0.0.0 否则其他机器访问不了(0.0.0.0填服务器的IP)

bundle exec rails server webrick -e production -b 10.40.3.63

plugins安装

agile
http://www.redmine.org/plugins/redmine_agile/
download and unzip to plugins
bundle install –without development test
bundle exec rake redmine:plugins NAME=redmine_agile RAILS_ENV=production

working time
wget https://bitbucket.org/tkusukawa/redmine_work_time/downloads/redmine_work_time-0.3.4.zip
tag zxvf redmine_work_time-0.3.4.zip
rake redmine:plugins:migrate RAILS_ENV=production

安装Nginx
gem install passenger
passenger-install-nginx-modul

按照以下步骤继续安装Nginx:

1、提示选择时,选择Ruby,继续
2、让你确认如何安装Nginx,选择“1”
3、让你确认Nginx是否安装在默认的opt/nginx下,直接回车
4、安装成功,再次回车

配置niginx

cd /opt/nginx/
cd conf/
vim nginx.conf

在末尾插入一行,并保存:
include vhost/*.conf;

创建文件夹,并配置:
mkdir -p /opt/nginx/conf/vhost
cd /opt/nginx/conf/vhost/
vim redmine.conf

server {
listen 80;
server_name 127.0.0.1;

    root /usr/local/redmine-3.2.6/public;
    passenger_enabled on;
    client_max_body_size      10m; # Max attachemnt size

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

保存并退出

配置Nginx服务

cd /lib/systemd/system/
vim nginx.service

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP MAINPIDExecStop=/bin/killsQUIT MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

重新加载配置文件并启动:
systemctl daemon-reload
systemctl start nginx

配置Nginx开机启动:
systemctl enable nginx.service

检查:
netstat -plntu | grep nginx

打开浏览器,输入:http://10.40.3.63 开始使用Redmine

Nginx基本操作命令:

systemctl daemon-reload
systemctl start nginx.service
systemctl stop nginx.service
systemctl status nginx.service
systemctl restart nginx.service
systemctl list-units –type=service

Redmine邮件的配置:

 修改Redmine下文件夹config中的email.yml,信息如下:
 cd usr/local/redmine-3.2.6/config
 vim email.yml

production:
delivery_method: :smtp
smtp_settings:
address: smtp.qiye.163.com
port: 25
domain: qiye.163.com
#authentication: :login
#user_name: “收件邮箱@rongzi.com”
#password: “密码”

development:
delivery_method: :smtp
smtp_settings:
address: smtp.qiye.163.com
port: 25
domain: qiye.163.com
authentication: :login
user_name: “收件邮箱@rongzi.com”
password: “密码”

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.qiye.163.com
port: 25
domain: qiye.163.com
authentication: :login
user_name: 收件邮箱@rongzi.com
password: 密码

development:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.qiye.163.com
port: 25
domain: qiye.163.com
authentication: :login
user_name: 收件邮箱@rongzi.com
password: 密码

启动Redmine服务:

bundle exec ruby bin/rails server webrick -p3000 -b 10.40.3.63 -e production -d

关闭Redmine服务(目前没有找到好的办法可以关闭):
stop
ps -ef
ps -aux |grep ruby
kill -9 ‘3364’

kill -9 6944

安装插件:

http://www.redmine.org/plugins/

cd plugins
下载插件到这个目录后

git clone https://github.com/themondays/redmine_worktime_log.git
git clone https://github.com/themondays/redmine_worktime.git

运行:rake redmine:plugins:migrate RAILS_ENV=production

rake版本问题:
查看版本:gem list | grep rake
安装指定的版本: gem install -v=12.0.0 rake
卸载之前的版本: gem uninstall -v=10.4.2 rack

登陆系统—管理—信息:

1、默认的管理员帐号已改变 点右上角我的账户—修改密码中修改自己的密码和邮箱
2、附件路径可写 Redmine附件有个路径,需要有些的权限,命令:chmod a+w -R /usr/local/redmine-3.2.6/files/
3、插件的附件路径可写 (./public/plugin_assets) 命令:chmod a+w -R /usr/local/redmine-3.2.6/public/plugin_assets

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值