在Ubuntu上安装DeepDive项目之后,我决定写一个详细的指南。 这些问题是基于源代码提供的test.sh
文件的输出结果 – 我还不能说源代码的function(刚开始学习)。
因为我搞砸了一些configuration文件,而这在我的Ubuntu体验还早,我决定重新安装操作系统(Precise 12.04),并从头开始重做一切。 因此,本指南基于Ubuntu 12.04的完整版本,在2014年3月20日之前安装了所有相关更新(通过Update Manager)。
DeepDive提供了一些先决条件:Java,Python 2.X,PostgreSQL和SBT。 Ubuntu 12.04已经有Python 2.X,所以我们会担心其他的。
我们将使用Ubuntu推荐的OpenJDK-7。 在terminal中input以下内容。
sudo apt-get update sudo apt-get install openjdk-7-jdk icedtea-7-plugin
现在,我们安装SBT。 使用以下链接下载debian文件或从网站获取 。 SBT依赖于curl,所以首先我会安装它。
sudo apt-get install curl cd /home/tom/Downloads sudo dpkg -i sbt.deb
现在我需要安装PostgreSQL,这是迄今为止最棘手的部分。 在本教程中,我假设您正在使用的计算机也将是PostgreSQL主机。 注意DeepDive使用JSON,这显然不被PostgreSQL 9.1和以下版本支持也很重要。 要安装版本9.3,我将在这个StackExchange文章中使用“Danny”给出的指令,并将数字更改为9.3:
wget -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - sudo gedit /etc/apt/sources.list.d/pgdg.list
将以下行添加到该文件 ,然后保存并closures:
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
请注意,“precise-pgdg”对应于您的Ubuntu版本。 现在让我们更新并安装。
sudo apt-get update sudo apt-get install pgdg-keyring postgresql-9.3
现在我们将安装DeepDive。 首先,我需要安装git,因为我使用的是新版本的操作系统。 然后,说明来自DeepDive页面 。 我将在我的主目录中安装DeepDive,但是如果你想在其他地方,修改cd
行。
sudo apt-get install git cd git clone https://github.com/dennybritz/deepdive.git cd deepdive sbt compile
如果我们现在进行深度testing,会给我们一些错误:
cd deepdive ./test.sh
[info] Run completed in 8 seconds, 322 milliseconds. [info] Total number of tests run: 71 [info] Suites: completed 18, aborted 0 [info] Tests: succeeded 69, failed 2, canceled 0, ignored 0, pending 3 [info] *** 2 TESTS FAILED *** [error] Failed tests: [error] org.deepdive.test.integration.LogisticRegressionApp [error] org.deepdive.test.unit.InferenceManagerSpec [error] Error during tests: [error] org.deepdive.test.unit.PostgresInferenceDataStoreSpec [error] org.deepdive.test.unit.PostgresExtractionDataStoreSpec [error] (test:test) sbt.TestsFailedException: Tests unsuccessful [error] Total time: 29 s, completed Mar 20, 2014 6:45:30 PM
为了解决这个问题,我们需要设置PostgreSQL。 首先,让我们激活本地和TCP / IP连接。
sudo gedit /etc/postgresql/9.3/main/postgresql.conf
修改 “连接和身份validation”中的以下行 :
#listen addresses = 'localhost'
至:
listen_addresses = 'localhost, 127.0.0.1, 192.168.1.10'
请注意,您应该在networking连接中检查自己的IP地址,并使用该地址,而不是以我的.10结尾。 还值得注意的是localhost和127.0.0.1是等价的。 现在,您需要确保您的路由器上的端口5432已被激活/打开。 对我来说,它是这样的:从浏览器访问路由器键入192.168.1.0 – >虚拟服务器 – >启用端口5432的IP地址192.168.1.10
现在我们需要第一次设置postgres超级用户。 以下行将以用户postgres的方式打开psql(感谢Ubuntu-PostgreSQL社区Wiki )
sudo -u postgres psql postgres
你应该看到postgres=#
和一个游标。 input以下内容,然后input您select的密码:
\password postgres
虽然我们仍然使用psql作为postgres超级用户,但是我们继续创build一个普通用户,它与您的Ubuntu用户帐户具有相同的名称。 这会让生活变得更轻松(至less对我而言)。 您可以使用\du
来检查用户的特征。
CREATE ROLE tom WITH SUPERUSER CREATEDB CREATEROLE REPLICATION LOGIN; \du
现在给这个用户添加一个密码,然后退出psql。
ALTER ROLE tom WITH PASSWORD 'your_pa$$w0rd'; \q
检查你现在是用户'汤',而不是用户'postgres-tom'。 如果是后者,则inputexit
我们现在需要一个额外的依赖关系来无错误。
sudo apt-get install gnuplot-x11
最后,我们需要稍微修改deepdive目录下的test.sh
文件。 这似乎是一个错误,testing“忘记”你在运行中提供的密码。 所以,让我们把它连接到那里。
cd gedit deepdive/test.sh
你会注意到在顶部的以下几行。
# Set username and password export PGUSER=${PGUSER:-`whoami`} export PGPASSWORD=${PGPASSWORD:-}
如果您想保存原始文件,请将名称更改为test_original.sh
。 我们将改变这些线(以你的情况为例):
# Set username and password export PGUSER=tom export PGPASSWORD=your_pa$$w0rd
好吧,现在转到你的deepdive文件夹,并运行testing!
cd deepdive ./test.sh
成功! 甜蜜,甜蜜的成功! 你应该看到以下内容:
[info] Run completed in 21 seconds, 280 milliseconds. [info] Total number of tests run: 90 [info] Suites: completed 20, aborted 0 [info] Tests: succeeded 90, failed 0, canceled 0, ignored 0, pending 3 [info] All tests passed. [success] Total time: 23 s, completed Mar 20, 2014 7:27:21 PM
不要问我有什么testing“待定”。 不知道。