2016年10月31日 星期一

CORD: LC_ALL not configured cause postgresql default cluster not created

ClouldLab, OnePC-Ubuntu14.04.4
bash ~/cord-in-a-box.sh -t | tee ~/install.out
When installing maas, the script failed. Running "sudo apt-get install maas" manually get the following error:

psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

It says there's no sql server listening at port 5432. "sudo apt-get install postgresql" shows the postgresql is already installed, but no default sql clusters created:
# pg_lsclusters
Ver Cluster Port Status Owner    Data directory    Log file
FIX1:
Setting a custom data directory for a new PostreSQL installation on Linux | Open Geospatial Technologies
http://geospatial.commons.gc.cuny.edu/2016/10/10/setting-a-custom-data-directory-for-a-new-postresql-installation-on-linux/

Let's create one:
sudo mkdir /data/sql-cluster -p
sudo pg_createcluster -d /data/sql-cluster --start 9.3 main
And you should see:
# pg_lsclusters
Ver Cluster Port Status Owner    Data directory    Log file
9.3 main    5432 online postgres /data/sql-cluster /var/log/postgresql/postgresql-9.3-main.log
Then install maas again:
sudo apt-get install maas

FIX2:
The default sql cluster is not created because the LC_ALL not configured.
command line - How do I fix my locale issue? - Ask Ubuntu
http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue

  1. At you ssh client, do not forward your locale to remote server by editing /etc/ssh/ssh_config and comment out SendEnv LANG LC_* line. Or run the following:
    sed -e '/SendEnv/ s/^#*/#/' -i /etc/ssh/ssh_config
  2. Connect to remote server, and:
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
  3. Then log-out and log-in again, LC_ALL should be there.
    # printenv | grep LC
    LC_ALL=en_US.UTF-8
Then if you do "sudo apt-get install postgresql", you should see the default cluster is created.
(........................)

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
 * No PostgreSQL clusters exist; see "man pg_createcluster"
Processing triggers for ureadahead (0.100.0-16) ...
Setting up postgresql-9.3 (9.3.14-0ubuntu0.14.04) ...
Creating new cluster 9.3/main ...
  config /etc/postgresql/9.3/main
  data   /var/lib/postgresql/9.3/main
  locale en_US.UTF-8
  port   5432
update-alternatives: using /usr/share/postgresql/9.3/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
 * Starting PostgreSQL 9.3 database server                               [ OK ]
Setting up postgresql (9.3+154ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...

$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory               Log file
9.3 main    5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log
Thus cord-in-a-box.sh won't failed here.



沒有留言: