最小化安装centos7.3+redmine3.3.3+passenger

来源:互联网 发布:应聘软件测试自我介绍 编辑:程序博客网 时间:2024/06/06 02:52

最小化安装centos7.3-1611

安装设置

  • 虚拟机
    2C,512M,20G,网络
  • 下载最小化iso文件
  • 安装设置
    最小化安装
    禁用kdump
    禁用安全策略 (security policy)
  • 设置网路
    桥接,ip信息
  • 设置用户信息

安装后设置

  • 确认网络
 # vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
  • 关闭selinux
# vi /etc/selinux/config修改SELINUX的值为permissive 或者 disabled(SELINUX=disabled)(不会用,先关闭)
  • 安装wget
# yum install wget
  • 修改yum源
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup# wget --output-document=/etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo# yum clean all# yum makecache
  • 系统更新
# yum update
  • 设置分辨率
# vi /boot/grub2/grub.cfg找到启动项,在后面添加vga=0x318 (1024px*768px*24bit)vga=ask 表示每次启动时选择

安装redmine3.3.3

常用命令

# yum list installed | grep xxx  > 是否安装# yum list | grep xxx  > 检查列表    

安装postgresql服务器

# yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm# yum install postgresql96-server# /usr/pgsql-9.6/bin/postgresql96-setup initdb# vi /var/lib/pgsql/9.6/data/pg_hba.conf  > 修改最后一个字段,从ident改为trust,如:  > host    all             all             127.0.0.1/32        trust  > host    all             all             192.168.99.0/24        md5# vi /var/lib/pgsql/9.6/data/postgresql.conf      > 添加: listen_addresses = '*'# systemctl start postgresql-9.6.service    # systemctl enable postgresql-9.6.service   # firewall-cmd --add-service=postgresql # firewall-cmd --permanent --add-port=5432/tcp  # firewall-cmd --reload   > 服务定义在:ll /usr/lib/firewalld/servicessu postgres psql -U postgres    ALTER USER postgres WITH PASSWORD 'apassword';  CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'apassword' NOINHERIT VALID UNTIL 'infinity';      CREATE DATABASE redmine WITH ENCODING='utf8' OWNER=redmine; \q    > 修改密码   > 创建新用户redmine,用密码

安装ruby环境

# yum list ruby # yum install gcc libxml2-devel postgresql96-devel    > 缺少这些,gem安装nokogiri,rails,pg等包的时候会出现错误。根据错误信息推测缺少的软件。# yum install ruby ruby-devel     > 包含ruby/gem/libyaml$ gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/      > 修改gem source$ gem install rake --no-document   $ gem i nokogiri --no-document -v='1.6.8'  $ gem i mime-types --no-document     > 出现依赖错误的时候需要手动安装指定的版本$ gem install rails --no-document -v='4.2.7'     > ruby 2 与最新的rails5不兼容$ gem install rbpdf --no-document  $ gem install rbpdf-font --no-document $ gem install pg -v '0.18.4' --no-document -- --with-pg_config=/usr/pgsql-9.6/bin/pg_config      > redmine不支持最新的0.19版本(bundle install)

安装redmine

  > 如果不做说明,当前目录为登陆用户主目录$ wget http://www.redmine.org/releases/redmine-3.3.3.tar.gz$ tar -xf redmine-3.3.3.tar.gz$ cd redmine/config$ cp database.yml.example database.yml$ vi database.yml  > 修改数据库配置为上面建立的pgsql(redmine@redmine)  > bundle会根据这里的驱动安装gem,所以把不需要的mysql/mysql2之类的东西都改成pgsql,以避免安装。$ cd ..$ bundle config mirror.https://rubygems.org https://ruby.taobao.org      > redmine用bundle管理gem,这里给bundle指定镜像$ bundle install --without development test rmagick -- --with-pg_config=/usr/pgsql-9.6/bin/pg_config --with-pg-config=/usr/pgsql-9.6/bin/pg_config $ bundle exec rake generate_secret_token  > 这个是生成redmine的什么token,不生成的话浏览器会连接不上的  > 每次生成,以前的cookie内容就会失效。$ RAILS_ENV=production bundle exec rake db:migrate $ RAILS_ENV=production REDMINE_LANG=zh bundle exec rake redmine:load_default_data  > 生成数据库对象$ bundle exec rails server webrick -e production$ wget http://localhost:3000  > 测试安装$ cp htaccess.fcgi.example htaccess.fcgi$ cp dispatch.fcgi.example dispatch.fcgi  > 为以后apache服务器对应(redmine/public目录)做准备

apache服务器

# yum install httpd   > 配置文件位置:/etc/httpd/conf/httpd.conf  > 修改,比如端口:9880# systemctl restart httpd.service     > 完成上面的所有事情之后,是时候重启 Apache HTTP 服务器了,然后新的端口号才能生效。# systemctl enable httpd.service      > 现在添加 Apache 服务到系统层使其随系统自动启动。# firewall-cmd --add-service=http     > 服务定义在:ll /usr/lib/firewalld/services# firewall-cmd --permanent --add-port=80/tcp      > 允许 http 服务通过防火墙(永久)。  > 允许 9880 号端口通过防火墙(永久)。# firewall-cmd --reload   > 重新加载防火墙。

passenger和相关配置

$ cd ~    $ passenger-install-apache2-module   > 会提示所有缺少的程序库,# sudo yum install gcc-c++ libcurl-devel httpd-devel apr-devel apr-util-devel openssl-devel   > 安装它们,注意 openssl-devel 也需要安装。$ passenger-install-apache2-module $ cd /etc/httpd/conf.d# sudo vi redmine.conf> 内容如下LoadModule passenger_module /home/redmine/.gem/ruby/gems/passenger-5.1.2/buildout/apache2/mod_passenger.so<IfModule mod_passenger.c>  PassengerRoot /home/redmine/.gem/ruby/gems/passenger-5.1.2  PassengerDefaultRuby /usr/bin/ruby</IfModule>RailsEnv productionRailsBaseURI /redmine<Directory /home/redmine/redmine-3.3.3/public>  Options FollowSymlinks  AllowOverride none  Require all granted</Directory>  > 内容引用结束$ ln -s /home/redmine/redmine-3.3.3/public /var/www/html/redmine $ chmod 750 /home/redmine

配置参考: https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/

邮件通知(QQ邮箱)

设置配置文件

cd ~/redmine/configcp configuration.yml.example configuration.yumvi configuration.yum

找到production,改成下面这样(账号和授权码已经隐去):

production:  email_delivery:    delivery_method: :async_smtp    async_smtp_settings:      address: "smtp.qq.com"      port: 587      enable_starttls_auto: true      authentication: :plain      domain: 'qq.com'      user_name: xxx@qq.com'      password: 'xxx'

*填在password处的内容在QQ邮箱中叫授权码,需要在QQ邮箱那边用手机获取。
重新启动apache。

设置邮件通知

用redmine管理员登陆系统,填写刚才配置的邮箱账号,保存,测试,然后登陆邮件系统,应该收到了测试邮件。

【以上】

0 0
原创粉丝点击