Guest User

redminec8.sh

a guest
Jul 19th, 2020
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. #https://kifarunix.com/install-redmine-with-apache-and-mariadb-on-centos-8/
  2.  
  3. useradd -r -m -d /opt/redmine redmine
  4.  
  5. dnf -y install httpd
  6.  
  7. systemctl enable httpd --now
  8.  
  9. usermod -aG redmine apache
  10.  
  11. dnf install -y epel-release
  12.  
  13. yum install -y 'dnf-command(config-manager)'
  14.  
  15. dnf config-manager --set-enabled PowerTools
  16.  
  17. cat << EOF > /etc/yum.repos.d/mariadb.repo
  18. [mariadb]
  19. name = MariaDB-10.4
  20. baseurl=http://yum.mariadb.org/10.4/centos8-amd64
  21. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  22. gpgcheck=1
  23. EOF
  24.  
  25. rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  26.  
  27. dnf install -y ruby-devel rpm-build libxml2-devel make automake libtool ImageMagick ImageMagick-devel gcc httpd-devel libcurl-devel gcc-c++ ruby wget galera-4 hostname sudo openssl-devel
  28.  
  29. #Failed to resolve typeattributeset statement at /var/lib/selinux/targeted/tmp/modules/400/mariadb/cil:1
  30. #/usr/sbin/semodule: Failed!
  31. #https://kifarunix.com/install-mariadb-10-4-on-centos-8/
  32. dnf --disablerepo=AppStream install -y MariaDB-server MariaDB-client MariaDB-devel
  33.  
  34. #this might break the version of /opt/redmine/.gem/ruby/gems/passenger-6.0.6/buildout/apache2/mod_passenger.so
  35. yum update -y
  36.  
  37. systemctl start mariadb
  38.  
  39. systemctl enable mariadb
  40.  
  41. mysql -e "create database redminedb;"
  42.  
  43. mysql -e "grant all on redminedb.* to redmineadmin@localhost identified by 'P@ssWorD';"
  44.  
  45. mysql -e "flush privileges;"
  46.  
  47. wget --no-check-certificate http://www.redmine.org/releases/redmine-4.0.5.tar.gz -P /tmp
  48.  
  49. usermod -a -G wheel redmine
  50.  
  51. sudo -u redmine tar xzf /tmp/redmine-4.0.5.tar.gz -C /opt/redmine/ --strip-components=1
  52.  
  53. #echo "1234" | passwd redmine --stdin
  54.  
  55. su - redmine
  56.  
  57. cp config/configuration.yml{.example,}
  58.  
  59. cp public/dispatch.fcgi{.example,}
  60.  
  61. cp config/database.yml{.example,}
  62.  
  63. sed -i '7s/.*/ database: redminedb/' config/database.yml
  64. sed -i '9s/.*/ username: redmineadmin/' config/database.yml
  65. sed -i '10s/.*/ password: "P@ssWorD"/' config/database.yml
  66.  
  67. gem install bundler
  68.  
  69. bundle install --without development test --path vendor/bundle
  70.  
  71. bundle exec rake generate_secret_token
  72.  
  73. #bundle exec rails server webrick -e production
  74.  
  75. #reran and it worked!
  76.  
  77. for i in tmp tmp/pdf public/plugin_assets; do [ -d $i ] || mkdir -p $i; done
  78.  
  79. chown -R redmine:redmine files log tmp public/plugin_assets
  80.  
  81. chmod -R 755 /opt/redmine/
  82.  
  83. bundle exec rails server webrick -e production &
  84.  
  85. RAILS_ENV=production bundle exec rake db:migrate
  86.  
  87. RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data
  88.  
  89. pkill ruby
  90.  
  91. gem install passenger --no-rdoc --no-ri
  92.  
  93. passenger-install-apache2-module -a
  94.  
  95. exit
  96.  
  97. #not sure if this needs to be before "passenger-install-apache2-module -a"
  98. cat << EOF > /etc/httpd/conf.d/redmine.conf
  99. Listen 3000
  100. LoadModule passenger_module /opt/redmine/.gem/ruby/gems/passenger-6.0.6/buildout/apache2/mod_passenger.so
  101. <IfModule mod_passenger.c>
  102. PassengerRoot /opt/redmine/.gem/ruby/gems/passenger-6.0.6
  103. PassengerDefaultRuby /usr/bin/ruby
  104. </IfModule>
  105. <VirtualHost *:3000>
  106. ServerName redmine
  107. DocumentRoot "/opt/redmine/public"
  108.  
  109. CustomLog logs/redmine_access.log combined
  110. ErrorLog logs/redmine_error_log
  111. LogLevel warn
  112.  
  113. <Directory "/opt/redmine/public">
  114. Options Indexes ExecCGI FollowSymLinks
  115. Require all granted
  116. AllowOverride all
  117. </Directory>
  118. </VirtualHost>
  119. EOF
  120.  
  121. mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.bak
  122.  
  123. systemctl restart httpd
  124.  
  125. #open ip:3000
  126. #have to open 3000
  127. #default username/pw is admin/admin
  128.  
  129. #bundle exec rails server webrick -e production &
Add Comment
Please, Sign In to add comment