尝试安装opennms时:
/usr/share/opennms/bin/install -l /usr/local/lib -dis
我得到错误:
错误:编码UTF8与区域设置en_US不匹配详细信息:所选的LC_CTYPE设置需要对LATIN1进行编码。
我不确定如何继续,因为我尝试过几种不同的方法来创建DB(见下文)。
完整日志:
==============================================================================
OpenNMS Installer
==============================================================================
Configures PostgreSQL tables, users, and other miscellaneous settings.
- searching for jicmp:
- trying to load /usr/local/lib/libjicmp.so: NO
- trying to load /usr/lib/jni/libjicmp.so: OK
- searching for jicmp6:
- trying to load /usr/local/lib/libjicmp6.so: NO
- trying to load /usr/lib/jni/libjicmp6.so: OK
- searching for jrrd:
- trying to load /usr/local/lib/libjrrd.so: NO
- trying to load /usr/lib/jni/libjrrd.so: NO
- trying to load /usr/lib/jni/libjrrd.so: NO
- trying to load /usr/lib/jvm/jdk1.6.0_34/jre/lib/amd64/server/libjrrd.so: NO
- trying to load /usr/lib/jvm/jdk1.6.0_34/jre/lib/amd64/libjrrd.so: NO
- trying to load /usr/lib/jvm/jdk1.6.0_34/jre/../lib/amd64/libjrrd.so: NO
- trying to load /libjrrd.so: NO
- trying to load /usr/share/opennms/lib/libjrrd.so: NO
- trying to load /usr/share/opennms/lib/linux64/libjrrd.so: NO
- trying to load /usr/java/packages/lib/amd64/libjrrd.so: NO
- trying to load /usr/lib64/libjrrd.so: NO
- trying to load /lib64/libjrrd.so: NO
- trying to load /lib/libjrrd.so: NO
- trying to load /usr/lib/libjrrd.so: NO
- trying to load /usr/lib/jni/libjrrd.so: NO
- trying to load /usr/lib/libjrrd.so: NO
- trying to load /usr/local/lib/libjrrd.so: NO
- trying to load /opt/NMSjicmp/lib/32/libjrrd.so: NO
- trying to load /opt/NMSjicmp/lib/64/libjrrd.so: NO
- trying to load /opt/NMSjicmp6/lib/32/libjrrd.so: NO
- trying to load /opt/NMSjicmp6/lib/64/libjrrd.so: NO
- Failed to load the optional jrrd library.
- This error is not fatal, since jrrd is only required for optional features.
- For more information, see http://www.opennms.org/index.php/jrrd
- using SQL directory... /usr/share/opennms/etc
- using create.sql... /usr/share/opennms/etc/create.sql
* using 'postgres' as the PostgreSQL user for OpenNMS
* using 'opennms' as the PostgreSQL database name for OpenNMS
Exception in thread "main" org.opennms.core.schema.MigrationException: an error occurred creating the OpenNMS database
at org.opennms.core.schema.Migrator.createDatabase(Migrator.java:428)
at org.opennms.core.schema.Migrator.prepareDatabase(Migrator.java:444)
at org.opennms.install.Installer.install(Installer.java:236)
at org.opennms.install.Installer.main(Installer.java:949)
Caused by: org.postgresql.util.PSQLException: ERROR: encoding UTF8 does not match locale en_US
Detail: The chosen LC_CTYPE setting requires encoding LATIN1.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:366)
at org.opennms.core.schema.Migrator.createDatabase(Migrator.java:425)
... 3 more
数据库列表:
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+-----------------------
postgres | postgres | LATIN1 | en_US | en_US |
rhq | rhqadmin | LATIN1 | en_US | en_US |
template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
我已经使用了以下3个initdb选项,但它们都不起作用
/usr/local/pgsql/bin/initdb -E UTF-8 --pgdata=/usr/local/pgsql/data
/usr/local/pgsql/bin/initdb -E LATIN1 --pgdata=/usr/local/pgsql/data
/usr/local/pgsql/bin/initdb -E en_US.UTF8 --pgdata=/usr/local/pgsql/data
另外,在使用initdb
之前,是否需要删除/usr/local/pgsql/data
中的所有数据?
附加区域设置命令stdout:
$语言环境
LANG=en_US
LANGUAGE=en_US:
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=
8条答案
按热度按时间cbjzeqam1#
我结合了其他网站的两个解决方案(这个答案适用于Ubuntu Server 12.04和PGSQL 9.1):
nano /etc/profile.d/lang.sh
.nwlls2ji2#
感谢
locale
输出。OpenNMS似乎使用了您的en_US(非UTF-8)语言环境来创建postgres数据库,这是错误的。hgb9j2n63#
这对我很有效:
7vux5j2d4#
发生这种情况的原因是您的系统设置为使用Latin 1编码而不是UTF-8。您的语言已正确设置为en_US,但编码未设置为UTF-8。请尝试运行以下命令:$
这将设置告诉你的所有应用程序安装后的变化(我认为)使用英语与unicode编码。更多信息可以在这里找到:https://www.linux.com/learn/docs/ldp/790-Unicode-HOWTO#s3
我也有类似的问题,所以我:
1.属性清除postresql...
1.本地定义f-v -c -i en_US -f UTF-8 en_US.UTF-8
然后PostRegSQL知道将其自身设置为使用具有Unicode编码的英语语言。
当然,您可以按每个数据库执行此操作,如下所述:http://www.postgresql.org/docs/9.1/static/multibyte.html
f4t66c6m5#
我也犯了同样的错误:
然后:
它的工作原理:)
yacmzcpb6#
更改SO的区域设置和语言,以与BD兼容。
dpkg-重新配置语言环境
好好享受吧!
snz8szmq7#
我遇到了类似的错误。旧的数据库LC_CTYPE是UTF-8,而新的数据库是en_US.UTF-8,我重新初始化数据库后解决了这个问题。
您应该选择正确的-E参数
h22fl7wq8#
我在安装odoo的时候遇到过“同样的问题”。原来在安装odoo之前,你必须配置locale
然后用UTF-8配置locale,但是你必须在安装posgres之前配置locale。