我不是那么进入Ruby,我有以下问题试图安装Redmine(这是在Ruby中开发的)在我的Ubuntu 16.04服务器上,我已经安装了MariaDB而不是MySql
我遵循这个官方指南:http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Ubuntu_step_by_step
所以,考虑到上一个教程,我遵循了所有的安装点,除了这一点:sudo apt-get install mysql-server mysql-client
因为我不想安装MySql Server,因为我刚刚安装了,我只是在这个服务器上使用 mariadb 。
当我执行以下语句安装gem打包器:
时,出现了安装问题sudo gem update
事实上,我正在获得这些错误消息,似乎是有关一个缺失的MySql安装(或者我认为是这样的…如果我做了错误的断言,请纠正我):
root@Betrivius-VPS:~# sudo gem update
Updating installed gems
Updating mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/mysql2-0.4.5/ext/mysql2
/usr/bin/ruby2.3 -r ./siteconf20161115-17323-1dd1r35.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
checking for mysql_query() in -lmysqlclient... no
-----
mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.5/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql2-0.4.5 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.5/gem_make.out
Gems updated: mysql2
所以,我的第一个疑问是,如果整个安装失败,还是只有一些部分?
你可以看到它是失败的东西是与MySql(我认为安装MySql服务器和bash MySql客户端)。
问题是,我没有使用MySql,但我必须使用MariaDB,我不能改变它。
阅读前面的错误输出,它说进一步的信息在这个文件中:/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.5/,这是它的内容:
current directory: /var/lib/gems/2.3.0/gems/mysql2-0.4.5/ext/mysql2
/usr/bin/ruby2.3 -r ./siteconf20161115-17488-ql00no.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
checking for mysql_query() in -lmysqlclient... no
-----
mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
--with-mysql-dir
从我所理解的在线阅读这个gem_make。out文件应该包含编译期间的错误(或类似的内容)。在我看来,它只说它缺少mysql客户端。
如何避免安装MySql并使用我的MariaDB安装?
MariaDB是MySQL的一个二进制插入式替代品,您可以在这里看到。它甚至运行在相同的端口和普通用户,不使用高级功能,甚至不会注意到MySQL是否突然被MariaDB取代。有一些不兼容的地方,但是在日常使用中要面对其中的一个需要一些努力。
在大多数Linux发行版中,包括那些采用MariaDB作为标准的发行版,如Slackware,构建头仍然是"MySQL-way"。
然后,您所需要做的就是保持MariaDB服务器的安装和运行。然后安装libmysqlclient-dev
,再安装bundle install
。一切都会好起来的。我已经做过很多次了。
我不知道你的Rails版本是什么,但是如果你遇到一些不兼容的问题,可以考虑升级到Rails 5。Rails 5似乎提供了对MariaDB的支持,就像这里所说的。但是我从来没有使用过这个支持,很遗憾,我不能告诉你关于它的任何事情。