Redmine部署安装手记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Redmine部署安装手记相关的知识,希望对你有一定的参考价值。
工作上杂事多,不能很好的汇报上级,所以想部署个项目管理规范规范。综合考虑后选择了很是折腾的Redmine,服务器上开了个虚拟机,装了Centos 7 minimal,参考Redmine官方文档开始部署。
1、安装一些常用软件
yum -y install screen vim wget svn
2、安装EPEL库
yum -y install epel-release
3、可选,关掉firewall(iptables默哀)
[[email protected] ~]# systemctl list-unit-files | grep -n ‘firewalld‘ 51:firewalld.service enabled [[email protected] ~]# systemctl disable firewalld.service [[email protected] ~]# systemctl list-unit-files | grep -n ‘firewalld‘ 50:firewalld.service disabled
4、安装依赖
yum -y install libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
5、安装Apache和MariaDB(MySQL)
yum -y install httpd mariadb mariadb-server systemctl enable httpd.service systemctl enable mariadb.service systemctl start httpd.service systemctl start mariadb.service
6、初始化MariaDB
[[email protected] ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! 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 ... skipping. 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 - Dropping test database... ... Success! - Removing privileges on test database... ... Success! 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!
7、装个webmin,装完浏览器通过SSL端口号10000访问,帐号密码同系统。
[[email protected] ~]# cat << EOF > /etc/yum.repos.d/webmin.repo > [Webmin] > name=Webmin Distribution Neutral > #baseurl=http://download.webmin.com/download/yum > mirrorlist=http://download.webmin.com/download/yum/mirrorlist > enabled=1 > EOF [[email protected] ~]# wget [[email protected] ~]# rpm --import jcameron-key.asc [[email protected] ~]# yum -y install webmin
8、通过RVM安装Ruby,用国内源加速
curl -L https://get.rvm.io | bash source /etc/profile.d/rvm.sh echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > /usr/local/rvm/user/db rvm install --disable-binary 2.4
9、安装Rubygems,用国内源加速
yum -y install rubygems gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
10、安装Passenger
[[email protected] ~]# gem install passenger [[email protected] ~]# passenger-install-apache2-module Almost there! Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8 PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.4.1/wrappers/ruby </IfModule> After you restart Apache, you are ready to deploy any number of web applications on Apache, with a minimum amount of configuration! Press ENTER when you are done editing. [[email protected] ~]# cat << EOF > /etc/httpd/conf.d/passenger.conf LoadModule passenger_module /usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8 PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.4.1/wrappers/ruby </IfModule> EOF [[email protected] ~]# systemctl restart httpd.service
11、创建数据库
[[email protected] ~]# mysql --user=root --password=XXX Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server version: 5.5.52-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. MariaDB [(none)]> create database redmine character set utf8; Query OK, 1 row affected (0.08 sec) MariaDB [(none)]> quit; Bye
12、安装Redmine,通过SVN拿版本
cd /var/www svn co --trust-server-cert --non-interactive https://svn.redmine.org/redmine/branches/3.4-stable redmine
13、配置Redmine数据库连接
cd /var/www/redmine/config cp database.yml.example database.yml vim database.yml # 只改production的参数即可 production: adapter: mysql2 database: redmine host: localhost username: root password: XXX encoding: utf8
14、配置Rails,国内源加速
cd /var/www/redmine gem install bundler bundle config mirror.https://rubygems.org https://gems.ruby-china.org bundle install rake generate_secret_token
15、部署Redmine数据库
RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data
16、启用FCGI
cd /var/www/redmine/public cp dispatch.fcgi.example dispatch.fcgi cp htaccess.fcgi.example .htaccess yum -y install mod_fcgid
17、配置httpd
[[email protected] config]# cat << EOF > /etc/httpd/conf.d/redmine.conf > <VirtualHost *:80> > DocumentRoot /var/www/redmine/public/ > ErrorLog logs/redmine_error_log > <Directory "/var/www/redmine/public/"> > Options Indexes ExecCGI FollowSymLinks > Order allow,deny > Allow from all > AllowOverride all > </Directory> > </VirtualHost> > EOF
18、运行Redmine
cd /var/www chown -R apache:apache redmine chmod -R 755 redmine systemctl restart httpd.service
19、访问网页,收工。
本文出自 “雪糕猪” 博客,请务必保留此出处http://icecreampig.blog.51cto.com/648013/1961339
以上是关于Redmine部署安装手记的主要内容,如果未能解决你的问题,请参考以下文章