Beginners Guide to Install Discourse on Ubuntu for Development

dev-install

(Discoursecurious) #247

i’m running the commands like a little monkey!
not understanding them but hoping they will work!

i’m on the forth try!
ubuntu under a virtual machine…

i can’t get it to work!
i’ll end up with

takes forever to complete! (it’s going on from this morning so around 6 hours!)

(i’ve skipped the bundle exec rake autospec because it never stopped on the prevous three tests!)

while it’s running i can open discourse on localhost in the browser but if i stop the terminal it stops working…

i would like to run the Vbullettin importer script! do i absolutely need the developer version of discourse?


(Rafael dos Santos Silva) #248

That command will never finish, it starts the webserver so you can use your browser and navigate to http://localhost:3000 and use Discourse.


(Jay Pfaffman) #249

That’s exactly right. The “s” in rails s stands for server.

Well, not really, but it’s probably easiest and you’ve already installed it.

Check out Importing from vBulletin 4 for how to run the importer. You’ll run the importer and then run the server (as you now know how to do) after the importer is done to see how it worked.


(Ryan Erwin) #250

On Ubuntu 18.04, I had to run:

sudo add-apt-repository universe

before the discourse dependencies script would work…
https://github.com/techAPJ/install-rails/blob/master/linux


(Dev Sanghvi) #251

Hello guys, I am getting this error. please help me to solve this

root@WINDOWS-G5B317T:~/discourse# bundle exec rake db:create db:migrate
No connection to db, unable to retrieve site settings! (normal when running db:create)
No connection to db, unable to retrieve site settings! (normal when running db:create)
No connection to db, unable to retrieve site settings! (normal when running db:create)
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:10: warning: already initialized constant MaxMindDB::DEFAULT_FILE_READER
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:10: warning: previous definition of DEFAULT_FILE_READER was here
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:14: warning: already initialized constant MaxMindDB::LOW_MEMORY_FILE_READER
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:14: warning: previous definition of LOW_MEMORY_FILE_READER was here
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:21: warning: already initialized constant MaxMindDB::Client::METADATA_BEGIN_MARKER
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:21: warning: previous definition of METADATA_BEGIN_MARKER was here
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:22: warning: already initialized constant MaxMindDB::Client::DATA_SECTION_SEPARATOR_SIZE
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:22: warning: previous definition of DATA_SECTION_SEPARATOR_SIZE was here
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:23: warning: already initialized constant MaxMindDB::Client::SIZE_BASE_VALUES
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:23: warning: previous definition of SIZE_BASE_VALUES was here
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:24: warning: already initialized constant MaxMindDB::Client::POINTER_BASE_VALUES
/home/dev/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/maxminddb-0.1.21/lib/maxminddb.rb:24: warning: previous definition of POINTER_BASE_VALUES was here
No connection to db, unable to retrieve site settings! (normal when running db:create)
No connection to db, unable to retrieve site settings! (normal when running db:create)
No connection to db, unable to retrieve site settings! (normal when running db:create)
No connection to db, unable to retrieve site settings! (normal when running db:create)
No connection to db, unable to retrieve site settings! (normal when running db:create)
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"?
Couldn't create database for {"prepared_statements"=>false, "adapter"=>"postgresql", "database"=>"discourse_development", "min_messages"=>"warning", "pool"=>5, "timeout"=>5000, "checkout_timeout"=>5, "host_names"=>["localhost"]}
rake aborted!
PG::ConnectionBad: 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"?
/home/dev/.rbenv/versions/2.5.1/bin/bundle:23:in `load'
/home/dev/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

(Sam Saffron) #254

Looks like you are not running posgres to me, did you follow all the PG steps correctly?

If you are getting stuck I SUPER HIGHLY recommend you try this:


(Dev Sanghvi) #256

I tried docker, but it shows this
root@WINDOWS-G5B317T:~/discourse# ./bin/docker/boot_dev --init
Using source in: /home/dev/discourse
Using data in: /home/dev/discourse/data/postgres
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.
root@WINDOWS-G5B317T:~/discourse# docker run daemon
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.
root@WINDOWS-G5B317T:~/discourse# systemctl start docker
System has not been booted with systemd as init system (PID 1). Can’t operate.

how to solve that?? I tried many ways but can’t solve this issue
Thank you for your help


(Sam Saffron) #257

:thinking: do you have docker installed.


#258

Hi guys, I got this error when I execute this:

xxx@DESKTOP-LICQPFO:~/discourse$ bundle exec rake db:create db:migrate

Discourse requires Ruby 2.5.2 or up

ruby -v

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]

I updated ruby to 2.5.3 but then I got another error when I run bundle install:

Warning: the running version of Bundler (1.16.1) is older than the version that created the lockfile (1.17.1). We suggest you upgrade to the latest version of Bundler by running gem install bundler.
Fetching gem metadata from https://rubygems.org/
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 1.0.1
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.0
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Fetching nokogiri 1.8.5
Installing nokogiri 1.8.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/xxxx/discourse/vendor/bundle/ruby/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri

/usr/bin/ruby2.5 -r ./siteconf20181111-13645-a4zobf.rb extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /home/xxxx/discourse/vendor/bundle/ruby/2.5.0/gems/nokogiri-1.8.5 for
inspection.
Results logged to
/home/xxxx/discourse/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.5/gem_make.out

An error occurred while installing nokogiri (1.8.5), and Bundler cannot continue.
Make sure that gem install nokogiri -v '1.8.5' succeeds before bundling.

In Gemfile:
actionmailer was resolved to 5.2.0, which depends on
actionpack was resolved to 5.2.0, which depends on
actionview was resolved to 5.2.0, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri

I ran gem install bundler nothing changes, I still have the warning message saying Warning: the running version of Bundler (1.16.1) is older than the version that created the lockfile

I ran gem install nokogiri -v ‘1.8.5’ but it generated another error:

xxxx@DESKTOP-LICQPFO:~/discourse$ gem install nokogiri -v ‘1.8.5’

Building native extensions. This could take a while…

/home/xxxx/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /home/xxxx/.rbenv/versions in PATH, mode 040777

Any help would be appreciated, thanks.


(Sam Saffron) #259

nokogiri can be rather difficult to install as it compiles a bunch of dependencies which are theoretically bundled see: GitHub - sparklemotion/nokogiri: Nokogiri (鋸) is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support.

Looking at that warning I am not seeing the actual error, are you sure this is all you have?

I would strongly recommend just going with our docker based dev environment to avoid a lot of this pain: discourse/bin/docker at master · discourse/discourse · GitHub


(Kyle Copeland) #260

For anyone that does not know how to restart postgres you can use the following command (I had to run this with sudo):

$ sudo service postgresql restart