在拥有以后很多问题 https://stackoverflow.com/questions/22469188/deepdive-installation-postgresql-error安装深潜项目 http://deepdive.stanford.edu/关于Ubuntu,我决定写一个详细的指南。这些问题是基于test.sh
随源提供的文件 - 我还不能谈论源的功能(刚刚开始学习)。
因为我弄乱了一些配置文件,而且这在我的 Ubuntu 体验中还处于早期阶段,所以我决定重新安装操作系统 (Precise 12.04) 并从头开始重做一切。因此,本指南基于截至 2014 年 3 月 20 日安装所有相关更新(通过更新管理器)后的 Ubuntu 12.04 的干净版本。
DeepDive 为我们提供了一些先决条件:Java、Python 2.X、PostgreSQL 和 SBT。 Ubuntu 12.04 已经有 Python 2.X,所以我们会担心其他的。
我们将使用 Ubuntu 推荐的 OpenJDK-7。在终端中输入以下内容。
sudo apt-get update
sudo apt-get install openjdk-7-jdk icedtea-7-plugin
现在,让我们安装 SBT。使用以下链接下载 debian 文件 http://repo.scala-sbt.org/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.13.1/sbt.deb或得到它从网站 http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html。 SBT 依赖于curl,所以首先我将安装它。
sudo apt-get install curl
cd /home/tom/Downloads
sudo dpkg -i sbt.deb
现在我需要安装 PostgreSQL,这是迄今为止最棘手的部分。在本教程中,我假设您正在使用的计算机也是 PostgreSQL 主机。还需要注意的是,DeepDive 使用 JSON,显然 PostgreSQL 9.1 及以下版本不支持 JSON。要安装版本 9.3,我将使用“Danny”给出的指令这个 StackExchange 帖子 https://askubuntu.com/questions/186610/how-do-i-upgrade-to-postgres-9-2,只需将数字更改为 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
添加以下行到文件,然后保存并关闭:
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,因为我使用的是新版本的操作系统。然后,指令来自深入了解页面 http://deepdive.stanford.edu/doc/installation.html。我将把 DeepDive 安装在我的主目录中,但如果你想在其他地方安装,请修改cd
line.
sudo apt-get install git
cd
git clone https://github.com/dennybritz/deepdive.git
cd deepdive
sbt compile
如果我们现在运行 Deepdive 测试,它会给我们一些错误:
CD深度潜水
./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
修改以下行在“连接和身份验证”中:
#listen addresses = 'localhost'
to:
listen_addresses = 'localhost, 127.0.0.1, 192.168.1.10'
请注意,您应该在网络连接中检查您自己的 IP 地址,并使用该地址代替我的 IP 地址(以 .10 结尾)。还值得注意的是 localhost 和 127.0.0.1 是等效的。现在,您需要确保路由器上的端口 5432 已激活/打开。对我来说,它类似于以下内容:从浏览器访问路由器,输入 192.168.1.0 -> 虚拟服务器 -> 为 IP 地址 192.168.1.10 启用端口 5432
现在我们需要第一次设置 postgres 超级用户。以下行将以用户 postgres 的身份打开 psql(感谢Ubuntu-PostgreSQL 社区 Wiki https://help.ubuntu.com/community/PostgreSQL)
sudo -u postgres psql postgres
你应该看到postgres=#
和一个光标。输入以下内容,然后输入您选择的密码:
\password postgres
虽然我们仍然在 psql 中作为 postgres 超级用户,但让我们继续创建一个普通用户,该用户与您的 Ubuntu 用户帐户同名。这将使生活变得更轻松(至少对我来说)。您可以使用\du
检查用户的特征。
CREATE ROLE tom WITH SUPERUSER CREATEDB CREATEROLE REPLICATION LOGIN;
\du
现在也为该用户添加密码,然后退出 psql。
ALTER ROLE tom WITH PASSWORD 'your_pa$$w0rd';
\q
检查您现在是否再次是用户“tom”,而不是用户“postgres-tom”。如果是后者,请输入exit
我们现在需要一个额外的依赖项才能无错误。
sudo apt-get install gnuplot-x11
最后,我们需要稍微修改一下test.sh
deepdive 目录中的文件。似乎存在一个错误,测试“忘记”了您在运行过程中提供的密码。所以,让我们把它硬连线在那里。
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 文件夹,然后运行测试!
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
不要问我哪些测试“待处理”。不知道。