ubuntu svn mysql_(原创)ubuntu x86_64下搭建redmine+svn+mysql+nginx+apache2

原创作品欢迎转载,转载请表明出处!

准备一台64位的操作系统,初始化的安装Linux/ubuntu版本的Linux。

1、安装ruby

#apt-get install ruby

#apt-getinstallruby1.8-dev

2、安装apache2

#apt-get install apache2

3、安装mysql

#apt-get install mysql-server

#apt-get install mysql-client

4、安装php

#apt-get install php5

#apt-get install  php5-mysql

#apt-get install php5-fpm

5、安装rubygems-1.4.2

# tar zxvf rubygems-1.4.2.tgz

# cd rubygems-1.4.2/

# ruby setup.rb

# ln -s /usr/bin/gem1.8 /usr/bin/gem

6、redmine环境的初始化

#vim /etc/resolv.conf

nameserver 8.8.8.8

nameserver 8.8..4.4

#gem install rails -v=2.3.5

#gem install mysql

#gem install i18n -v=0.4.2

#gem install rack -v=1.0.1

#gem install rake -v=0.9.2.2

#apt-getinstalllibopenssl-ruby1.8

#apt-getinstalllibmysqlclient-dev

#gem install passenger -v=3.0.7

7、建立数据库

#mysql -uroot -p

:password

>>create database redmine character setutf8;

>>grant all privileges on redmine.*to @'llocalhost'identifiedby 'redmine';

8、下载整理redmine

#tar zxvf  redmine-1.1.2.tar.gz

#mv redmine-1.1.2   /opt/redmine

#cd /opt/redmine/config

# cp database.yml.example database.yml

#vim database.yml

production:

adapter: mysql

database: redmine

host: localhost

username: redminename

password: redminepassword

encoding: utf8

#cd ../

#vim start.sh

#!/bin/bash

rake generate_session_store

RAILS_ENV=production rake db:migrate

RAILS_ENV=production rake redmine:load_default_data

nohup ruby script/server webrick -e production  &

#chmod a+x start.sh

#./start.sh

#chmod-R755files log tmp public/plugin_assets

这样就能通过http://ip:3000访问一个初始话成功的redmine了

缺省的用户和密码均为admin

9、STMP的设置

#cd /opt/redmine/config

#cp configuration.yml.example  configuration.yml

#vim configuration.yml

production:

email_delivery:

delivery_method: :smtp

smtp_settings:

address: smtp.gmail.com

port: 587

authentication: :login

domain: smtp.gmail.com

user_name: mike@gmail.com

password: testredmine

tls: true

10、redmine与nginx的整合

#passenger-install-nginx-module(选择安装nginx,同时选择默认的路径/opt/nginx即可)

#cd /opt/nginx/conf

#vim nginx.conf

user  www-data;

worker_processes  1;

error_log  /var/log/nginx/error.log;

pid        /var/run/nginx.pid;

events {

worker_connections  1024;

}

http {

passenger_root /var/lib/gems/1.8/gems/passenger-3.0.15;

passenger_ruby /usr/bin/ruby1.8;

include       mime.types;

default_type  application/octet-stream;

access_log  /var/log/nginx/access.log;

sendfile        on;

keepalive_timeout  65;

gzip  on;

upstream  php-fpm  {

server  unix:/tmp/php-fpm.sock;

}

include /etc/nginx/conf.d/*.conf;

include /etc/nginx/sites-enabled/*;

}

#vim /etc/nginx/redmie.conf

server {

listen  192.168.3.26:80;

server_name  redmine.ethnicity.com;

root /opt/redmine/public;

passenger_enabled  on;

client_max_body_size 100M;

client_body_buffer_size 256k;

access_log  /var/log/nginx/redmine.ethnicity.com-access.log;

}

#vim /etc/init.d/nginx

#! /bin/sh

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DAEMON=/opt/nginx/sbin/nginx

NAME=nginx

DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available

if [ -f /etc/default/nginx ] ; then

. /etc/default/nginx

fi

set -e

. /lib/lsb/init-functions

test_nginx_config() {

if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1

then

return 0

else

$DAEMON -t $DAEMON_OPTS

return $?

fi

}

case "$1" in

start)

echo -n "Starting $DESC: "

test_nginx_config

start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \

--exec $DAEMON -- $DAEMON_OPTS || true

echo "$NAME."

;;

stop)

echo -n "Stopping $DESC: "

start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \

--exec $DAEMON || true

echo "$NAME."

;;

restart|force-reload)

echo -n "Restarting $DESC: "

start-stop-daemon --stop --quiet --pidfile \

/var/run/$NAME.pid --exec $DAEMON || true

sleep 1

test_nginx_config

start-stop-daemon --start --quiet --pidfile \

/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true

echo "$NAME."

;;

reload)

echo -n "Reloading $DESC configuration: "

test_nginx_config

start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \

--exec $DAEMON || true

echo "$NAME."

;;

configtest)

echo -n "Testing $DESC configuration: "

if test_nginx_config

then

echo "$NAME."

else

exit $?

fi

;;

status)

status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?

;;

*)

echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2

exit 1

;;

esac

exit 0

11、svn的安装设置

# ll /home/svn/repos/

drwxrwsr-x 7 www-data www-data 4096 2012-08-16 14:51 ./

drwxr-xr-x 7 root     root     4096 2012-08-16 14:51 ../

drwxrwsr-x 2 www-data www-data 4096 2012-08-16 14:51 conf/

drwxrwsr-x 3 www-data www-data 4096 2012-08-16 14:51 dav/

drwxrwsr-x 7 www-data www-data 4096 2012-08-16 14:40 db/

-r--r--r-- 1 www-data www-data    2 2012-08-16 14:51 format

drwxrwsr-x 2 www-data www-data 4096 2012-08-16 14:33 hooks/

drwxrwsr-x 2 www-data www-data 4096 2012-08-16 14:33 locks/

-rw-r--r-- 1 www-data www-data  229 2012-08-16 14:51 README.txt

# cat /home/svn/www/index.html

HTML>

Subversion Repositories

12、svn与redmine与mysql与apache2的整合

#passenger-install-apache2-module

#vim /etc/apache2/apache2.conf

ServerName localhost

LockFile ${APACHE_LOCK_DIR}/accept.lock

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

StartServers          5

MinSpareServers       5

MaxSpareServers      10

MaxClients          150

MaxRequestsPerChild   0

StartServers          2

MinSpareThreads      25

MaxSpareThreads      75

ThreadLimit          64

ThreadsPerChild      25

MaxClients          150

MaxRequestsPerChild   0

StartServers          2

MinSpareThreads      25

MaxSpareThreads      75

ThreadLimit          64

ThreadsPerChild      25

MaxClients          150

MaxRequestsPerChild   0

User ${APACHE_RUN_USER}

Group ${APACHE_RUN_GROUP}

AccessFileName .htaccess

Order allow,deny

Deny from all

Satisfy all

DefaultType text/plain

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

Include mods-enabled/*.load

Include mods-enabled/*.conf

Include httpd.conf

Include ports.conf

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %O" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

Include conf.d/

Include sites-enabled/

#vim /etc/apache2/port.conf

NameVirtualHost *:8080

Listen 8080

Listen 443

Listen 443

# vim /etc/apache2/sites-available/svn

ServerAdmin

ServerName svn.ethnicity.com

DocumentRoot /home/svn/www

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

Dav svn

SVNPath /home/svn/repos

AuthType Basic

AuthName "Please use your Redmine account"

AuthBasicAuthoritative Off

AuthUserFile /dev/null

AuthMYSQL On

AuthMySQL_Host localhost

AuthMySQL_DB redmine

AuthMySQL_User redmine

AuthMySQL_Password redmineloginpassword

AuthMySQL_Password_Table redmineuser

AuthMySQL_Group_Table redminetable

AuthMySQL_Username_Field username

AuthMySQL_Password_Field passwd

AuthMySQL_Encryption_Types SHA1Sum

Require  valid-user

ErrorLog /var/log/apache2/svn.ethnicity.com-error.log

LogLevel warn

CustomLog /var/log/apache2/svn.ethnicity.com-access.log combined

#a2ensite svn

13、svn集成redmine的mysql表的认证

#aptitude install libapache2-mod-auth-mysql

#a2enmod dav_fs

#a2enmod dav

#a2enmod auth_mysql

#/etc/init.d/apache2 restart

14、svn和nginx的整合

#vim /etc/nginx/sites-enabled/svn.conf

server {

listen  192.168.3.26:80;

server_name  svn.ethnicity.com ;

client_max_body_size 50M;

access_log  /var/log/nginx/svn.ethnicity.com-access.log;

location / {

proxy_pass        http://svn.ethnicity.com:8080;

proxy_set_header  X-Real-IP  $remote_addr;

}

}

15、测试

#cd /opt/redmine

#./start.sh

#/etc/init.d/nginx restart

#/etc/init.d apahe2 restart

最后即可实现,通过redmine页面往mysql里写入数据,而这些数据中的用户数据可以用于svn用户的验证。

配置成功的背后需要大量的错误和摸索来支撑,希望以后有时间推出下篇"redmine+svn整合中的错误以及解决办法的集锦"谢谢大家!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值