Ubuntu使用apt-get安装Apache2报如下错误时的解决方案Thefollowingpackageshaveunmetdependencies:apache2:Depends:apache2-bin(=2.4.7-1ubuntu4)butitisnotgoingtobeinstalledE:Unabletocorrectproblems,youhaveheldbrokenpackages.运行如下命令sudoapt-get-fautoremovesudoapt-ge
Ubuntu使用apt-get安装Apache2报如下错误时的解决方案
The following packages have unmet dependencies: apache2 : Depends: apache2-bin (= 2.4.7-1ubuntu4) but it is not going to be installedE: Unable to correct problems, you have held broken packages.
运行如下命令
sudo apt-get -f autoremove;sudo apt-get update;sudo apt-get upgrade;sudo apt-get dist-upgrade
sudo apt-get install apache2
首先升级一下源
apt-get update
更新完成
PS:(如果图省事,可以选择LAMP套件安装,此处指mysql和apache此处不用套件安装了 )安装apache2和apache2的一个模块apt-get install apache2 libapache2-mod-passenger安装mysqlapt-get install mysql-server mysql-client
配置mysql数据库.
数据库是mysql,为redmine建立库,库名redmine。同时创建redmine用户,把库的权限分配给这个用户。最后设置用户的密码为’123456’。当然这里的库名、用户名和密码,可以按实际情况替换。
mysql -u
root –p
mysql> create database redmine character set utf8;
mysql> grant select,insert,delete,update,create,drop,alter,index on redmine.* to redmine;
mysql> SET PASSWORD FOR ‘redmine’ = PASSWORD(‘123456’);
mysql> flush privileges;
mysql> exit;
安装ruby
sudo apt-get install ruby-full
安装后执行ruby -v,
显示“ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]“
如果是1.8版本以下的 安装到了/usr/lib/ruby/1.8目录,需要再安装 rubygems
安装rubygems
注意:不需要再手动把ruby路径加到PATH,因为已经加好了,见/usr/bin
sudo apt-get install rubygems
执行gem -v,显示“1.3.7”
注意:ruby1.9自带gem,不需要再次安装
安装 rails
sudo apt-get install rails
rails -v 如果报错:“程序 rails 尚未安装“。
在用户的 .bashrc文件中追加export PATH=/var/lib/gems/1.8/bin:$PATH
后注:应该加到全局环境变量里,因为有的命令,如rake,需要root用户执行
sudo apt-get install redmine-mysql
这个是redmine的mysql 插件包
sudo apt-get install redmine
中间按照提示输入MySQL的root的用户密码,输入正确后即可创建Mysql默认库,此处一定要保证在MySql中创建过redmine用户。
运行并测试redmine
Redmine默认安装目录为 /usr/share/redmine,首先检测
有没有/usr/share/redmine/log/production.log文件,没有则按照目录建立
切换到目录/usr/share/redmine
运行命令:ruby script/rails server webrick -e production
即可启动redmine,默认打开3000端口,可以通过http://localhost:3000/访问(管理员初始用户名和密码都是admin)。
如果希望Redmine作为服务运行,加上-d参数即可:ruby script/rails server webrick -e production –d
修改redmine的端口号:
在redmine/vendor/rails/railties/lib/commands/servers.rb文件中:
1 | options = { |
port就是端口。将其值改为4000即可。
解决使用访问慢的问题
安装好后,本机运行很顺畅,但是用IP访问,一个页面30秒读不出来。
后来发现是默认的服务器webrick的问题,需要解析目标地址的主机名,换个服务器用mongrel
解决
在终端执行指令gem install mongrel
启动:ruby script/rails server webrick -e production–d