由于原来小的服务器不能满足需求了,所以把git和 redmine 都迁移到新的服务器上去;分享下部署过程:
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev zlib1g-dev libssl-dev build-essential curl git-core libc6-dev g++ gcc libcurl4-openssl-dev
sudo apt-get install mysql-server //安装过程中会要求设置root密码。
默认mysql只有127.0.0.1地址可以访问,修改mysql配置: sudo nano /etc/mysql/my.cnf
将其中的"bind-address=127.0.0.1"注释掉即可
重启mysql: sudo /etc/init.d/mysql restart
登录mysql: mysql -u root -p //输入密码
修改密码:
mysql -u root -p 输入密码: mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpassword') WHERE user = 'root'; mysql> FLUSH PRIVILEGES;
sudo apt-get install ruby-full build-essential rubygems rails sudo gem install rdoc -v 2.4.2
接下来就是安装redmine :
sudo apt-get install redmine-mysql redmine
安装过程中需要配置一下数据库的密码,这里我选择的是mysql数据库。
redmine的默认安装目录是 : /usr/share/redmine
ok,安装完成后,下面先做一个符号链接: sudo ln -s /usr/share/redmine/public /var/redmine
sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql在这里我们使用php-fastcgi ,配置参考:http://wiki.nginx.org/Ubuntu-php-fastcgi
#!/bin/bash BIND=127.0.0.1:9000 USER=www-data PHP_FCGI_CHILDREN=15 PHP_FCGI_MAX_REQUESTS=1000 PHP_CGI=/usr/bin/php-cgi PHP_CGI_NAME=`basename $PHP_CGI` PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND" RETVAL=0 start() { echo -n "Starting PHP FastCGI: " start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS RETVAL=$? echo "$PHP_CGI_NAME." } stop() { echo -n "Stopping PHP FastCGI: " killall -q -w -u $USER $PHP_CGI RETVAL=$? echo "$PHP_CGI_NAME." } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: php-fastcgi {start|stop|restart}" exit 1 ;; esac exit $RETVAL赋予它执行的权限: sudo chmod +x /etc/init.d/php-fastcgi
wget http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.2.2/phpMyAdmin-3.5.2.2-all-languages.tar.gz sudo tar xzvf phpMyAdmin-3.5.2.2-all-languages.tar.gz sudo mv phpMyAdmin-3.5.2.2-all-languages/* /srv/www/phpmyadmin
下载并解压Nginx:
wget http://nginx.org/download/nginx-1.4.0.tar.gz tar xzvf nginx-1.4.0.tar.gz安装passenger并编译nginx源文件:
sudo gem install passenger sudo passenger-install-nginx-module
然后安装步骤安装:
1、因为我是自己下载的nginx源码包,所以我选择第二项:
2、填写解压下载下来的nginx源码包后的路径(我是放在用户目录下面的: ~/);
3、然后一直回车什么都不用填(默认安装到 /opt/nginx 目录下面)
最后我们配置下nginx就可以使用了:
cd /opt/nginx/conf/ sudo cp nginx.conf nginx.conf.old sudo nano nginx.conf
user www-data; worker_processes 1; events { worker_connections 1024; } http { server_names_hash_bucket_size 64; passenger_root /var/lib/gems/1.8/gems/passenger-3.0.19; passenger_ruby /usr/bin/ruby1.8; passenger_pool_idle_time 1000; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; include mime.types; default_type application/octet-stream; #access_log logs/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; gzip on; server { listen 80; server_name localhost; root /srv/www; index index.php index.html index.htm; location / { index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /redmine { root /var; passenger_enabled on; passenger_base_uri /redmine; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /srv/www/$fastcgi_script_name; include fastcgi_params; } } include /opt/nginx/conf/BlogConf/*.conf; }
注意新建的文件的上层目录要设置权限: sudo chown -R www-data:www-data /srv/www/
关闭apache: sudo /etc/init.d/apache2 stop
禁止apache2开机自启动: sudo update-rc.d -f apache2 remove
开启nginx: sudo /opt/nginx/sbin/nginx
到这就全部安装好了,输入http://serverIP/phpmyadmin 可以访问就表示安装正确了: