centos6.8_x64,
apache-2.4.33,
mysql-5.6.16,
php-5.5.6,
ruby-2.1.5,
rubygems-2.7.6,
subversion-1.8.9,
svnmanager-1.10,
redmine-2.5.3
1.挂载数据盘
# mkdir -p /mnt/data# fdisk -l
# fdisk /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xd2b51b0b.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610):
Using default value 2610
Command (m for help): p
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xceb05905
Device Boot Start End Blocks Id System
/dev/sdc1 1 2610 20964793+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# mkfs.ext4 /dev/vdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mount /dev/vdb1 /mnt/data
# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 29G 2.4G 25G 9% /
tmpfs 1.7G 0 1.7G 0% /dev/shm
/dev/sdb1 133G 188M 126G 1% /mnt/resource
/dev/sdc1 20G 172M 19G 1% /mnt/data
2.设置开机启动自动挂载
# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Jan 15 04:45:47 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=6d089360-3e14-401d-91d0-378f3fd09332 / ext4 defaults 1 1
/dev/vdb1 /mnt/data auto defaults 0 0
:wq
3.重启系统
# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.7G 36G 5% /
devtmpfs 911M 0 911M 0% /dev
tmpfs 920M 0 920M 0% /dev/shm
tmpfs 920M 392K 920M 1% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
tmpfs 184M 0 184M 0% /run/user/0
/dev/vdb1 296G 65M 281G 1% /mnt/data
4.安装基础包
# yum -y install makeapr* autoconf automake gcc gcc-c++ zlib-devel openssl openssl-devel pcre-develgd kernel keyutils patch perl kernel-headers compat* mpfr cppglibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch lrzsz vin curl-devel php-mcrypt libmcrypt libmcrypt-devel vim mod_ssl bzip2
5.安装Apache
5.1 安装apr
# tar -zxvf apr-1.6.3.tar.gz
# cd apr-1.6.3
# ./configure --prefix=/usr/local/apr
# make
# make install
# cd ..
5.2 安装expat
# tar vxjf expat-2.2.3.tar.bz2
# cd expat-2.2.3
# ./configure --prefix=/usr/local/expat
# make
# make install
# cd ..
5.2 安装apr-util
# tar -zxvf apr-util-1.6.1.tar.gz
# cd apr-util-1.6.1
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --with-expat=/usr/local/expat
# make
# make install
# cd ..
5.3 安装pcre
# tar -zxvf pcre-8.42.tar.gz
# cd pcre-8.42
# ./configure --prefix=/usr/local/pcre
# make
# make install
# cd ..
5.4 安装openssl
# tar -zxvf openssl-1.0.2o.tar.gz
# cd openssl-1.0.2o
# ./config --prefix=/usr/local/openssl -fPIC no-gost
# make
# make install
# cd ..
5.5 安装apache
# yum list |grep httpd
httpd.x86_64 2.2.15-60.el6.centos.6 @updates
httpd-tools.x86_64 2.2.15-60.el6.centos.6 @updates
httpd-devel.i686 2.2.15-60.el6.centos.6 updates
httpd-devel.x86_64 2.2.15-60.el6.centos.6 updates
httpd-itk.x86_64 2.2.22-7.el6 epel
httpd-manual.noarch 2.2.15-60.el6.centos.6 updates
iipsrv-httpd-fcgi.noarch 1.0.0-1.0.el6 epel
libmicrohttpd.i686 0.9.33-4.el6 base
libmicrohttpd.x86_64 0.9.33-4.el6 base
libmicrohttpd-devel.i686 0.9.33-4.el6 base
libmicrohttpd-devel.x86_64 0.9.33-4.el6 base
libmicrohttpd-doc.noarch 0.9.33-4.el6 base
lighttpd.x86_64 1.4.47-1.el6 epel
lighttpd-fastcgi.x86_64 1.4.47-1.el6 epel
lighttpd-mod_authn_gssapi.x86_64 1.4.47-1.el6 epel
lighttpd-mod_authn_mysql.x86_64 1.4.47-1.el6 epel
lighttpd-mod_geoip.x86_64 1.4.47-1.el6 epel
lighttpd-mod_mysql_vhost.x86_64 1.4.47-1.el6 epel
mirmon-httpd.noarch 2.11-1.el6 epel
python-mozhttpd.noarch 0-0.3.gitb077641.el6 epel
python2-sphinxcontrib-httpdomain.noarch 1.5.0-3.el6 epel
sysusage-httpd.noarch 5.5-3.el6 epel
viewvc-httpd.noarch 1.1.26-1.el6 epel
web-assets-httpd.noarch 5-2.el6 epel
# yum -y remove httpd
Removed:
httpd.x86_64 0:2.2.15-60.el6.centos.6
Dependency Removed:
mod_ssl.x86_64 1:2.2.15-60.el6.centos.6
Complete!
# tar -zxvf httpd-2.4.33.tar.gz
# cd httpd-2.4.33
# ./configure --prefix=/usr/local/apache --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl
# make
# make install
# cd ..
5.6 安装 fcgid模块
# tar zxvf mod_fcgid-2.3.9.tar.gz
# cd mod_fcgid-2.3.9
# APXS=/usr/local/apache/bin/apxs./configure.apxs
# make
# make install
# cd ..
5.7 修改apache配置
# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
# vi /etc/init.d/httpd
在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description:Start and stops the Apache HTTP Server.
:wq
# chmod +x /etc/init.d/httpd
# chkconfig --add httpd
# mkdir -p /var/www/html
# vi /usr/local/apache/conf/httpd.conf
添加
ServerName localhost:80
修改
DocumentRoot "/usr/local/apache2/htdocs" => DocumentRoot"/var/www/html"
<Directory "/usr/local/apache2/htdocs"> => <Directory "/var/www/html">
:wq
5.8 验证
# service httpd start
6.安装Mysql
6.1 安装Cmake
# tar -xzvf cmake-2.8.10.2.tar.gz
# cd cmake-2.8.10.2
# ./bootstrap
# make
# make install
# cd ..
6.2 设置mysql用户组
# groupadd mysql
# useradd -r -g mysql mysql
6.3 创建mysql 安装目录
# mkdir -p /usr/local/mysql
# mkdir -p /mnt/data/mysqldb
6.4 编译安装MySQL-5.6.16
# rpm -qa |grep mysql
mysql-libs-5.1.73-8.el6_8.x86_64
# rpm -e --nodeps mysql-libs-5.1.73-8.el6_8.x86_64
# tar -zxvf mysql-5.6.16.tar.gz
# cd mysql-5.6.16
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mnt/data/mysqldb -DMYSQL_TCP_PORT=???? -DSYSCONFDIR=/etc -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_bin -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_DEBUG=0 -DWITH_READLINE=1 -DWITH_SSL=yes
# rm CMakeCache.txt 重新运行配置,需要删除CMakeCache.txt文件
# make
# make install
# cd ..
6.5 配置数据库
# chown -R mysql.mysql /usr/local/mysql
# cd /usr/local/mysql/
# chown -R mysql.mysql /mnt/data/mysqldb
# scripts/mysql_install_db --user=mysql --datadir=/mnt/data/mysqldb
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h xry-svn password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
# cp support-files/mysql.server /etc/init.d/mysqld
# vi /etc/profile
追加
export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
:wq
# source /etc/profile
# vi /etc/my.cnf
追加
datadir = /mnt/data/mysqldb
:wq
# chmod 755 /etc/init.d/mysqld
# chkconfig mysqld on
# service mysqld start
Starting MySQL. [ OK ]
# /usr/local/mysql/bin/mysqladmin -u root -p password 'xry1901'
Enter password: 回车
# service mysqld restart
Shutting down MySQL.. [ OK ]
Starting MySQL. [ OK ]
# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.16 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> grant all privileges on *.* to 'root'@'**.**.??.??' identified by 'aaaaaa' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
7.安装Ruby
# cd /usr/local/src
# tar xzf ruby-2.1.5.tar.gz
# cd ruby-2.1.5
# ./configure --prefix=/usr/local/ruby
# make
# make install
# cd ..
# vi /etc/profile
export PATH=/usr/local/ruby/bin:$PATH
:x
# source /etc/profile
# ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
# tar -zxvf rubygems-2.7.6.tgz
# cd rubygems-2.7.6
# ruby setup.rb
# gem -v
2.7.6
# which gem
/usr/local/ruby/bin/gem
# gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/
# gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
https://gems.ruby-china.org/ added to sources
https://rubygems.org/ removed from sources
Redmine需要考虑Ruby版本兼容性问题,请参考:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
Redmine选择安装2.5.3版本,因此rails安装3.2版本
# gem install rails -v=3.2.19
Done installing documentation for erubis, hike, multi_json, rack, tilt, sprockets, journey, rack-test, builder, rack-cache, concurrent-ruby, i18n, activesupport, activemodel, actionpack, rdoc, thor, rack-ssl, railties, mime-types, polyglot, treetop, mail, actionmailer, activeresource, tzinfo, arel, activerecord, rails after 52 seconds
29 gems installed
# rails -v
Rails 3.2.19
# cd ..
曾经遇到的问题
# gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
处理方案
# cd ruby-2.1.5/ext/openssl/
# ruby extconf.rb --with-openssl-include=/usr/local/openssl/include/ --with-openssl-lib=/usr/local/openssl/lib/
# vi Makefile
增加
top_srcdir = ../..
:x
# make
# make install
/usr/bin/install -c -m 0755 openssl.so /usr/local/ruby/lib/ruby/site_ruby/2.1.0/x86_64-linux
installing default openssl libraries
8.安装PHP 5.5.6
yum -y install python-devel
8.1 安装zlib
# tar zxvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure --prefix=/usr/local/zlib
# make
# make install
# cd ..
8.2 安装libxml2
# tar zxvf libxml2-2.9.7.tar.gz
# cd libxml2-2.9.7
# ./configure --prefix=/usr/local/libxml2 --without-zlib
# make
# make install
# cd ..
8.3 安装libpng
# tar zxvf libpng-1.6.34.tar.gz
# cd libpng-1.6.34
# ./configure--prefix=/usr/local/libpng
# make
# make install
# cd ..
8.4 安装freetype
# tar zxvf freetype-2.5.0.1.tar.gz
# cd freetype-2.5.0.1
# ./configure --prefix=/usr/local/freetype -without-png
# make
# make install
# cd ..
8.5 安装jpeg9
# tar zxvf jpegsrc.v9.tar.gz
# cd jpeg-9/
# ./configure --prefix=/usr/local/jpeg9
# make
# make install
# cd ..
8.6 安装libmcrypt
# tar -zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# mkdir -p /usr/local/libmcrypt
# ./configure --prefix=/usr/local/libmcrypt/
# make
# make install
# cd ..
8.7 安装GD
# tar -zxvf gd-2.0.35.tar.gz
# cd gd-2.0.35
# mkdir -p /usr/local/gd
./configure --prefix=/usr/local/gd--enable-m4_pattern_allow --with-jpeg=/usr/local/jpeg9 --with-png=/usr/local/libpng --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype --with-libmcrypt=/usr/local/libmcrypt
# make
# make install
# cd ..
8.8 安装PHP-5.5.6
# tar -zxvf php-5.5.6.tar.gz
# cd php-5.5.6
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg9 --with-png-dir=/usr/local/libpng --with-zlib=/usr/local/zlib --with-libxml-dir=/usr/local/libxml2 --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --without-pear --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-session --with-mcrypt=/usr/local/libmcrypt/ --enable-mbstring --with-pdo-mysql=/usr/local/mysql
# make
# make install
# mkdir -p /usr/local/php/etc
# cp php.ini-production /usr/local/php/etc/php.ini
# cd ..
8.9 修改apache配置
# vi /usr/local/apache/conf/httpd.conf
添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
修改
Options Indexes FollowSymLinks => Options Indexes FollowSymLinks Includes IncludesNOEXEC ExecCGI
:wq
# service httpd restart
8.10 追加curl模块
# tar zxvf curl-7.59.0.tar.gz
# cd curl-7.59.0
# ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl
# make
# make install
# cd ..
# cd php-5.5.6/ext/curl/
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-curl=/usr/local/curl
# make
# make install
# cd ..
# vi /usr/local/php/etc/php.ini
追加
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20121212/curl.so
:wq
# cd ../..
9.安装redmine-2.5.3
9.1 解压程序文件
# tar xzf redmine-2.5.3.tar.gz -C /var/www/
# mv /var/www/redmine{-2.5.3,}
9.2 安装依赖包
# cd /var/www/redmine/
# gem install mysql2 -v'0.3.21' #用mysql2能提供性能
Fetching: mysql2-0.5.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.5.1
Parsing documentation for mysql2-0.5.1
Installing ri documentation for mysql2-0.5.1
Done installing documentation for mysql2 after 0 seconds
1 gem installed
# gem install bundler #注意是在网站根目录下执行
Fetching: bundler-1.16.2.gem (100%)
bundler's executable "bundle" conflicts with /usr/local/ruby/bin/bundle
Overwrite the executable? [yN] y
Successfully installed bundler-1.16.2
Parsing documentation for bundler-1.16.2
Installing ri documentation for bundler-1.16.2
Done installing documentation for bundler after 7 seconds
1 gem installed
# gem install builder -v'3.0.0'
# gem install coderay -v'1.1.0'
# gem install json -v '1.8.2'
# gem install jquery-rails -v '2.0.3'
# gem install net-ldap -v '0.3.1'
# gem install ruby-openid -v '2.3.0'
# gem install rack-openid -v '1.4.2'
# gem install redcarpet -v '2.3.0'
# bundle install --without development test rmagick # 再次执行
Bundle complete! 20 Gemfile dependencies, 39 gems now installed.
Gems in the groups development, test and rmagick were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
9.3 初始化redmine数据库
# cd /var/www/redmine/config
# cp database.yml.example database.yml
# vi database.yml
production:
adapter: mysql2
database: redmine
host: 127.0.0.1 //建议使用IP地址,而非机器名redmine.server,默认的webrick在解析服务器名称方面效率非常低,导致响应非常慢,redmine.server
username: redmine
password: "zaq12wsx"
encoding: utf8
:wq
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.16 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database redmine default character set utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| redmine |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> grant all privileges on *.* to 'r??'@'127.0.0.1' identified by '?????' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
# rake generate_secret_token 为Rails生成cookies秘钥
(in /var/www/redmine)
# RAILS_ENV=production rake db:migrate 创建数据库结构
# RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data
9.4 调整redmine相关目录
# cd ..
# pwd
/var/www/redmine
# mkdir -p public/plugin_assets
# chown -R daemon.daemon /var/www/redmine
# mkdir -p /mnt/data/redmine/attachments
# chown -R daemon.daemon /mnt/data/redmine
9.5 修改redmine 配置文件
# cp config/configuration.yml.example config/configuration.yml
# vi config/configuration.yml
修改
delivery_method: smtp => delivery_method: async_smtp
attachments_storage_path: /mnt/data/redmine/attachments
:wq
10. 整合Apache和Redmine
10.1 安装Passenger
# gem install passenger
Fetching: passenger-5.3.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed passenger-5.3.1
Parsing documentation for passenger-5.3.1
Installing ri documentation for passenger-5.3.1
Done installing documentation for passenger after 5 seconds
1 gem installed
# passenger-install-apache2-module --h
# ln -s /usr/local/apache2 /etc/httpd
# mkdir -p /usr/lib/httpd
# ln -s /usr/local/apache2/modules /usr/lib/httpd/modules
# ln -s /usr/local/apache2/bin/httpd /usr/sbin/httpd
# ln -s /usr/local/apache2/bin/apxs /usr/sbin/apxs
# yum install httpd-devel
# passenger-install-apache2-module --apxs2-path=/usr/local/apache/bin/apxs --apr-config-path=/usr/local/apr/bin/apr-1-config
Here's what you can expect from the installation process:
1. The Apache 2 module willbe installed for you.
2. You'll learn how toconfigure Apache.
3. You'll learn how to deploya Ruby on Rails application.
Press Enter to continue, or Ctrl-C to abort.
Use <space> to select.
If the menu doesn't display correctly, press '!'
? ? Ruby
? Python
? Node.js
? Meteor
按回车继续
Almost there!
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.3.1/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.3.1
PassengerDefaultRuby /usr/local/ruby/bin/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.
--------------------------------------------
Validating installation...
* Checking whether this Passenger install is in PATH... ?
* Checking whether there are no other Passenger installations... ?
* Checking whether Apache is installed... ?
* Checking whether the Passenger module is correctly configured in Apache... (!)
You did not specify 'LoadModule passenger_module' in any of your Apache
configuration files. Please paste the configuration snippet that this
installer printed earlier, into one of your Apache configuration files, such
as /usr/local/apache/conf/httpd.conf.
Detected 0 error(s), 1 warning(s).
Press ENTER to continue.
--------------------------------------------
Deploying a web application
To learn how to deploy a web app on Passenger, please follow the deployment
guide:
https://www.phusionpassenger.com/library/deploy/apache/deploy/
Enjoy Phusion Passenger, a product of Phusion? (www.phusion.nl) :-)
https://www.phusionpassenger.com
Passenger? is a registered trademark of Phusion Holding B.V.
10.2 配置Apache加载Passenger
# vi /usr/local/apache/conf/httpd.conf
追加
LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.3.1/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.3.1
PassengerDefaultRuby /usr/local/ruby/bin/ruby
</IfModule>
取消 LoadModule rewrite_module modules/mod_rewrite.so的#注释
取消 Include conf/extra/httpd-vhosts.conf的#
:wq
# vi /usr/local/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin xxx@xxxx.com
DocumentRoot "/var/www/redmine/public"
ServerName …..**.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
<Directory /var/www/redmine/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
<Location />
AddHandler fcgid-script .fcgi
FCGIWrapper "/usr/local/ruby/bin/ruby /usr/local/redmine/public/dispatch.fcgi" .fcgi
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin xxx@xxx.com
DocumentRoot "/var/www/html/svnmanager-1.10"
ServerName svn.xxxx.com
ServerAlias svnmanager
<Directory /var/www/html/svnmanager-1.10>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin xxx@xxxx.com
DocumentRoot "/var/www/html"
ServerName IP
</VirtualHost>
:wq
# cd /var/www/redmine/public/
# cp dispatch.fcgi.example dispatch.fcgi
# cp htaccess.fcgi.example .htaccess
# cd /usr/local/src/
# tar zxvf svnmanager-1.10.tar.gz
# mv /usr/local/src/svnmanager-1.10 /var/www/html/
# service httpd restart
11.安装SVN
11.1 安装扩展包
# cd /usr/local/src/
# tar -zxvf sqlite-autoconf-3080800.tar.gz
# cd sqlite-autoconf-3080800
# ./configure --prefix=/usr/local/sqlite
# make
# make install
# cd ..
# tar -zxvf scons-2.3.2.tar.gz
# cd scons-2.3.2
# python setup.py install
# cd ..
# tar -xvjf serf-1.2.1.tar.bz2
# cd serf-1.2.1
# ./configure --prefix=/usr/local/serf --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-openssl=/usr/local/openssl
# make
# make install
# cd ..
11.2安装SVN
# tar -zxvf subversion-1.8.9.tar.gz
# cd subversion-1.8.9
# ./configure --prefix=/usr/local/subversion --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-sqlite=/usr/local/sqlite --enable-maintainer-mode --with-zlib=/usr/local/zlib --with-serf=/usr/local/serf --with-openssl=/usr/local/openssl
# make
# make install
# /usr/local/subversion/bin/svnserve --version
# ln -s /usr/local/subversion/bin/svn /usr/local/bin/svn
# svn --version
11.3 配置Apache
# mkdir -p /mnt/data/svndata/svn
# mkdir -p /mnt/data/svndata/trash
# chown -R daemon.daemon /mnt/data/svndata
# mkdir -p /usr/local/apache/conf/ssl/svn
# mkdir -p /usr/local/apache/conf/ssl/redmine
上传证书文件到ssl的对应目录
# vi /usr/local/apache/conf/httpd.conf
以下取消#
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule ssl_module modules/mod_ssl.so
#Include conf/extra/httpd-ssl.conf
添加
LoadModule dav_svn_module /usr/local/subversion/libexec/mod_dav_svn.so
LoadModule authz_svn_module /usr/local/subversion/libexec/mod_authz_svn.so
DirectoryIndex index.html index.php
<Location /svn>
DAV svn
SVNParentPATH /mnt/data/svndata/svn
SVNListParentPath on
AuthType Basic
AuthName "usernamne used lowwer spell"
AuthUserFile "/mnt/data/svndata/passwordfile"
AuthzSVNAccessFile "/mnt/data/svndata/accessfile"
Require valid-user
SSLRequireSSL
</Location>
:wq
# vi /usr/local/apache/conf/extra/httpd-ssl.conf
变更
DocumentRoot "/mnt/data/svndata"
ServerName svn.xxxx.com:443
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
SSLHonorCipherOrder on
SSLCertificateFile "/usr/local/apache/conf/ssl/svn/public.pem"
SSLCertificateChainFile "/usr/local/apache/conf/ssl/svn/chain.pem"
:wq
# service httpd restart
12.安装SVNmanager
# cd /usr/local/php/
# curl -o go-pear.php http://pear.php.net/go-pear.phar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3512k 100 3512k 0 0 355k 0 0:00:09 0:00:09 --:--:-- 416k
# ./bin/php go-pear.php
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : /usr/local/php
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /usr/local/php/bin
5. PHP code directory ($php_dir) : /usr/local/php/share/pear
6. Documentation directory : /usr/local/php/docs
7. Data directory : /usr/local/php/data
8. User-modifiable configuration files directory : /usr/local/php/cfg
9. Public Web Files directory : /usr/local/php/www
10. System manual pages directory : /usr/local/php/man
11. Tests directory : /usr/local/php/tests
12. Name of configuration file : /usr/local/php/etc/pear.conf
1-12, 'all' or Enter to continue: 回车
Beginning install...
Configuration written to /usr/local/php/etc/pear.conf...
Initialized registry...
Preparing to install...
installing phar:///usr/local/php/go-pear.php/PEAR/go-pear-tarballs/Archive_Tar-1.4.3.tar...
installing phar:///usr/local/php/go-pear.php/PEAR/go-pear-tarballs/Console_Getopt-1.4.1.tar...
installing phar:///usr/local/php/go-pear.php/PEAR/go-pear-tarballs/PEAR-1.10.5.tar...
installing phar:///usr/local/php/go-pear.php/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar...
installing phar:///usr/local/php/go-pear.php/PEAR/go-pear-tarballs/XML_Util-1.4.2.tar...
install ok: channel://pear.php.net/Archive_Tar-1.4.3
install ok: channel://pear.php.net/Console_Getopt-1.4.1
install ok: channel://pear.php.net/Structures_Graph-1.1.1
install ok: channel://pear.php.net/XML_Util-1.4.2
install ok: channel://pear.php.net/PEAR-1.10.5
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
</usr/local/php/share/pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.
Would you like to alter php.ini </usr/local/php/etc/php.ini>? [Y/n] : y
php.ini </usr/local/php/etc/php.ini> include_path updated.
Current include path : .:
Configured directory : /usr/local/php/share/pear
Currently used php.ini (guess) : /usr/local/php/etc/php.ini
Press Enter to continue:
** WARNING! Old version found at /usr/local/php/bin, please remove it or be sure to use the new /usr/local/php/bin/pear command
The 'pear' command is now at your service at /usr/local/php/bin/pear
** The 'pear' command is not currently in your PATH, so you need to
** use '/usr/local/php/bin/pear' until you have added
** '/usr/local/php/bin' to your PATH environment variable.
Run it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.
For more information about PEAR, see:
http://pear.php.net/faq.php
http://pear.php.net/manual/
Thanks for using go-pear!
# /usr/local/php/bin/pear install DB-1.7.14.tgz
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading DB-1.7.14.tgz ...
Starting to download DB-1.7.14.tgz (134,864 bytes)
.............................done: 134,864 bytes
install ok: channel://pear.php.net/DB-1.7.14
# /usr/local/php/bin/pear install -a XML_Parser-1.3.2.tgz
WARNING: "pear/XML_Parser" is deprecated in favor of "pear/XML_Parser2"
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading XML_Parser-1.3.2.tgz ...
Starting to download XML_Parser-1.3.2.tgz (16,416 bytes)
......done: 16,416 bytes
install ok: channel://pear.php.net/XML_Parser-1.3.2
# /usr/local/php/bin/pear install -a VersionControl_SVN-0.5.0.tgz
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading VersionControl_SVN-0.5.0.tgz ...
Starting to download VersionControl_SVN-0.5.0.tgz (31,482 bytes)
.........done: 31,482 bytes
install ok: channel://pear.php.net/VersionControl_SVN-0.5.0
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.6.16 Source distribution
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database dbname default character set utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on dbname.* to account@127.0.0.1 identified by 'passwor' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
# cd /var/www/html/svnmanager-1.10/
# mv config.php.linux config.php
# vi config.php
修改
$lang = "en_US.UTF-8";
//Shell command's
$htpassword_cmd = "/usr/local/apache/bin/htpasswd";
$svn_cmd = "/usr/local/subversion/bin/svn";
$svnadmin_cmd = "/usr/local/subversion/bin/svnadmin --config-dir /tmp";
//Subversion locations
$svn_config_dir = "/tmp";
$svn_repos_loc = "/mnt/data/svndata/svn";
$svn_passwd_file = "/mnt/data/svndata/passwordfile";
$svn_access_file = "/mnt/data/svndata/accessfile";
//If the following is set, removing a repository will cause it to be
//moved to this location rather than being deleted.
$svn_trash_loc = "/mnt/data/svndata/trash";
// If $svnserve_user_file is defined, then SVNManager will create a
// user/password file suitable for use with SVNSERVE
//
// When not set, this feature isn't enabled.
//
// Warning: When enabled, this mode requires that passwords are stored in the database readable!
//
// Note: When is feature is enabled later, passwords need to be re-set before they are included in
// the svnserve user file.
//
//$svnserve_user_file = "/var/www/repos/svnserve_passwd_file";
$svnserve_user_file="";
//SMTP Server for outgoing mail
$smtp_server = "smtp.mailserver.net";
//Data Source Name (only tested with mysql and sqlite!!)
//
//A database will be automatically created when SVNManager is first started, if you
//make sure that the credentials have database creation rights!
//
//An empty SQLite database will automatically be generated with the first
//startup!
//
//Please note that if you change the directory for a SQLite database that you
//choose a location that is not accessible via web!!
$dsn = "mysqli://account:password@127.0.0.1/dbname";
//The following location for SQLite is not readable from internet by means of an .htaccess file
//$dsn = "sqlite://svnmanager/svnmanager.db";
//Administrator account (only for first time use, when you create an admin user this account will be unusable)
$admin_name = "admin";
$admin_temp_password = "admin";
// If $post_create_script is defined, then this script / command will be
// executed after a repository is created.
// When the script/command is executed the one and only parameter will be
// the physical location of the repository.
// This might copy a default set of hooks or config files
//
// $post_create_script = "newrepo-script";
:wq
打开网页svnmanager目录
http://svn.xxxxxx.com
首次运行
All tables are missing.
Creating requried tables...
Please reload page!
重新刷新页面,正确显示
采用配置文件中临时的$admin_name ,$admin_temp_password 登录系统,创建正式的管理员用户
然后使用正式的管理员用户登录系统,即可进行全部操作。
到此为止,基本的已经完成
网页访问svn目录用https://svn.xxxxx.com
13.配置SVN加载Pear,Version
# ln -s /usr/local/php/share/pear/PEAR.php ./PEAR.php
# ln -s /usr/local/php/share/pear/PEAR ./PEAR
# ln -s /usr/local/php/share/pear/VersionControl ./VersionControl
# ln -s /usr/local/php/share/pear/System.php ./System.php