Beginners Guide to Install Discourse on Ubuntu for Development

Hi, to Setup Database I’m stuck :frowning: I have Ubuntu 20.04

ubuntu@oec:~$ sudo -u postgres createuser -s "$ubuntu"
sudo: unknown user: postgres
sudo: unable to initialize policy plugin
ubuntu@oec:~$ sudo -u ubuntu createuser -s "$USER"
sudo: createuser: command not found
ubuntu@oec:~$ sudo -u postgres createuser -s "ubuntu"
sudo: unknown user: postgres
sudo: unable to initialize policy plugin

How I have to set this?

Setup Database

Create role with the same name as your ubuntu system username :

sudo -u postgres createuser -s "$USER"

Sorry for the stupid question…

EDIT: I’m trying Ubuntu 18.04 now, but it is stuck on bash <(wget -qO- https://raw.githubusercontent.com/techAPJ/install-rails/master/linux)

It can’t install Ruby 2.7.1 on Ubuntu 18.04

The createuser command and postgres system user should come in the postgresql-12 package. Did you apt install postgresql-12 ?

2 Likes

Postgres should be ok now, I have tried 2/3 times and at the end it works, I have database.

The rest was going well but now I’m stuck in the end, with bundle exec rake autospec:

and it doesn’t go on :frowning:

When I try to check http://localhost:3000/ I have ERR_CONNECTION_REFUSED :frowning:

Hi,

The run linux script is failing on Ubuntu with below error.

E: Unable to locate package libqtwebkit-dev
failed

Can someone please help on how to resolve this ?

Here is the command-
log_info “Installing libraries for common gem dependencies …”
sudo apt-get -y install libxslt1-dev libcurl4-openssl-dev libksba8 libksba-dev libqtwebkit-dev libreadline-dev libssl-dev zlib1g-dev libsnappy-dev

Error:
Installing libraries for common gem dependencies …

Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libqtwebkit-dev
failed

Thanks

I take it you are installing using Ubuntu 20.x. This has been reported earlier in the post. Just step back to Ubuntu 18.04 for now.

1 Like

Some useful commands for checking the status of running instances

lsof -i

or

lsof -wni tcp:[port]

Thanks @merefield for this

COMMAND     PID        USER  FD  TYPE  DEVICE  SIZE/OFF  NODE  NAME
mailcatch  3244  rickyc0626  7u  IPv4   36127       0t0   TCP  localhost:1025 (LISTEN)
mailcatch  3244  rickyc0626  8u  IPv4   36128       0t0   TCP  *:socks (LISTEN)
redis-ser  3287  rickyc0626  6u  IPv6   29352       0t0   TCP  *:6379 (LISTEN)
redis-ser  3287  rickyc0626  7u  IPv6   29353       0t0   TCP  *:6379 (LISTEN)

sudo ss -plunt | grep postgres
tcp  LISTEN  0  128  127.0.0.1:5432  0.0.0.0:*  users:(("postgres",pid=3070,fd=7))

pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
10  main    5432 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
3 Likes

That can be a bit verbose, I use lsof -wni tcp:3000 (or whatever port you are using)

2 Likes

Got a new SSD, and following these steps got the development server up and running in less than 30 minutes.

2 Likes

As regular user - you mean as a sudo user?

After RAILS_ENV=test bundle exec rake db:create db:migrate

I have often this error: warning: unable to access '/home/ /.config/git/attributes': Permission denied