Centos 7的设定
- 修改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
- 开启防火墙:
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”
Ruby和Passenger的必要文件
yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel安装MariaDB数据库
yum -y install mariadb-server mariadb-devel安装图片支持包
yum -y install ImageMagick ImageMagick-devel
安装Ruby2.2
cd ..
cd usr/local
下载源码(centos 7自带的ruby rmp包为2.0)
curl -O https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz安装
tar xvf ruby-2.2.2.tar.gz
cd ruby-2.2.2
./configure –disable-install-doc
make
make install
cd ..
- 安装bundle
将ruby源修改为淘宝源
gem sources –add https://ruby.taobao.org/ –remove https://rubygems.org/
gem sources -l
安装
gem install bundler –no-rdoc –no-ri
MariaDB设置
- 设置utf8
vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
Disabling symbolic-links is recommended to prevent assorted security risks
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
设置开机启动
systemctl start mariadb.service
systemctl enable mariadb.service设置root密码
Pwd:Dfss@456
在Root目录下,执行命令:
mysql_secure_installation
- #在下面输出中,进行操作
- In order to log into MariaDB to secure it, we’ll need the current
- password for the root user. If you’ve just installed MariaDB, and
- you haven’t set the root password yet, the password will be blank,
- so you should just press enter here.
- Enter current password for root (enter for none): #直接回车
- OK, successfully used password, moving on…
- Setting the root password ensures that nobody can log into the MariaDB
- root user without the proper authorisation.
- Set root password? [Y/n] y
- New password: #输入新的密码
- Re-enter new password: #再次输入密码
- Password updated successfully!
- Reloading privilege tables..
- … Success!
- By default, a MariaDB installation has an anonymous user, allowing anyone
- to log into MariaDB without having to have a user account created for
- them. This is intended only for testing, and to make the installation
- go a bit smoother. You should remove them before moving into a
- production environment.
- Remove anonymous users? [Y/n] y
- … Success!
- Normally, root should only be allowed to connect from ‘localhost’. This
- ensures that someone cannot guess at the root password from the network.
- Disallow root login remotely? [Y/n] n
- … Success!
- By default, MariaDB comes with a database named ‘test’ that anyone can
- access. This is also intended only for testing, and should be removed
- before moving into a production environment.
- Remove test database and access to it? [Y/n] y
- Reloading the privilege tables will ensure that all changes made so far
- will take effect immediately.
- Reload privilege tables now? [Y/n] y
- … Success!
- Cleaning up…
- All done! If you’ve completed all of the above steps, your MariaDB
- installation should now be secure.
Thanks for using MariaDB!
设置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
- 连接设置
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
- 安装gem的依赖
修改ruby源
cd /usr/local/redmine-3.2.6
vim Gemfile
修改第一行为:
source ‘https://ruby.taobao.org/’
安装依赖
bundle install –without development test –path vendor/bundle
- 管理平台初始设置
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/kill−sQUIT
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