Last day I was reinstalling postgresql on my Ubuntu 12.04 server. I started with normal commands
1 |
sudo apt-get install postgresql postgresql-client postgresql-common |
The installation completed successfully. I was also getting the locale warning message
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_PAPER = "en_GB.UTF-8", LC_ADDRESS = "en_GB.UTF-8", LC_MONETARY = "en_GB.UTF-8", LC_NUMERIC = "en_GB.UTF-8", LC_TELEPHONE = "en_GB.UTF-8", LC_IDENTIFICATION = "en_GB.UTF-8", LC_MEASUREMENT = "en_GB.UTF-8", LC_TIME = "en_GB.UTF-8", LC_NAME = "en_GB.UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). |
and as I remembered from before, the fix for this is to add
1 |
LC_ALL="en_US.utf-8" |
at the bottom of file /etc/environment. All looked ok, but when I started database
1 |
sudo /etc/init.d/postgresql start |
I didn’t get any message. Then when I logged into postgres with
1 |
su - postgres |
and wanted to create database, I got warning
1 2 3 |
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"? |
I checked around and a lot of them mentioned that I had wrong or incomplete settings. Because I didn’t know what to do, I asked around (postgresql channel on freenode) and got really simple solution. I just had to run command
1 |
pg_createcluster 9.1 main --start |
where 9.1 is version of my postgresql database. This recreated settings file and now everything works great.