I have been trying to set up vagrant but I am getting this error. I will list out my installation method. Please suggest changes where you feel they are needed.
-Installed virtual boxsudo apt-get install virtual box
-Downloaded .deb package from vagrant website
-Installed it usingsudo dpkg -i (package_name)
-then I selected the vagrant folder in the fullstack folder andvagrant up
vagrant ssh
then I did :vagrant@vagrant-ubuntu-trusty-32: cd /vagrant/forum
vagrant@vagrant-ubuntu-trusty-32:/vagrant/forum$ sudo apt-get install postgresql-client-common
vagrant@vagrant-ubuntu-trusty-32:/vagrant/forum$ sudo apt-get install postgres-xc-client
Then finally:vagrant@vagrant-ubuntu-trusty-32:/vagrant/forum$ psql
psql: FATAL: role "vagrant" does not exist
You need to change to the postgres
user and give vagrant superuser access.
sudo su - postgres
createuser vagrant -s
exit # exit from postgres user back into vagrant
You can do everything with with vagrant now.
This is happening because there is no role specified in postgres. When there is no role specified, it tries to use the username of the account as the default role and hence your error. So, now, you could either create a role in postgres for the vagrant user or just use the postgres user itself. So, first, login with the postgres user:
psql -U postgres
then, create a role for the user vagrant
CREATE ROLE vagrant LOGIN;
In case, if you want it with a password, use:
CREATE USER vagrant WITH PASSWORD 'password';
or
CREATE ROLE vagrant WITH LOGIN PASSWORD 'password';
CREATE USER is the same as CREATE ROLE with the exception that USER implies LOGIN.
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With