community-contributed installation stories
* You can safely skip this is you already have an OS installed on your machine.
This provides a basic way to setup an OS environment for wagn:
everything should start and now you are at the login,
enter root and the password
$ su
enter root password
Remove the cd from the sources
http://askubuntu.com/questions/236288/apt-get-asks-me-to-insert-cd-why
$ gedit /etc/apt/sources.list
and simply add to this line with the #-sign so that it looks something like this:
# deb cdrom:[Ubuntu 12.10
then do:
$ apt-get update
Install sudo (you'll be able to execute commands as administrator without becoming root first)
$ apt-get install sudo
Creating new user and making it an administrator
$ adduser myuser
Type in a password and don't forget it. Press enter at all the other questions.
Add 'myuser' to the sudoers
$ visudo
http://serverfault.com/questions/58378/add-new-user-with-root-access-in-linux
Scroll down and under the line where is says root type your name
## Allows just user "username" to run all commands as root
mir ALL=(ALL) ALL
Type to exit the root shell
$ exit
empty
empty
I have just set up an wagn in my local Ubuntu Server with Apache and want to share how it's done.
Assuming that you are on a fresh Installation of Ubuntu 14.04 start with the usual steps:
sudo apt-get update && sudo apt-get dist-upgrade
After the updates are done it's time to get rvm and ruby:
sudo apt-get curl
\curl -sSL https://get.rvm.io | bash -s stable
rvm install ruby
Now let's install apache with Passenger Support:
sudo apt-get install apache2 libapache2-mod-passenger
sudo a2enmod passenger
Imagemagick is also needed so lets get this to:
sudo apt-get install imagemagick libmagickwand-dev
Not to forget about the Database:
sudo apt-get install mysql-server
Let's create an Database user for wagn:
sudo mysql -u root -pmysql> create user 'wagn' identified by 'secret'; mysql> grant all on *.* to 'wagn';
mysql> quit;
This will create the mysql user 'wagn' with the password 'secret'. this user has all rights on your mysql Server.
Now should everything be prepared and you can get the gems:
gem install image_science bundler wagn passenger
If any dependancies need to be fulified, gem will show you the necessary steps.
I've created an extra folder below /opt to put my wagn sites and set the rights:
sudo mkdir /opt/wagn/
sudo chown <user>:<usergroup> /opt/wagn/
<user> and <usergroup> should be the user and his group wich run ruby.
Now let's create our first wagn site:
wagn new /opt/wagn/mysite
Then install all necessary bundles
cd /opt/wagn/mysite
bundler install
Edit the opt/wagn/mysite/config/database.yml and put your former created mysql user with his password in the Production settings.
Now let's create the Database:
wagn seed
And Finally let's add the Passenger:
cd ~
passenger-install-apache2-module
Edit your passenger.load file and fill in the LoadModule line as given by the passenger-install:
sudo nano /etc/apache2/mods-enabled/passenger.load
Edit your passenger.conf file and fill in the IfModule mod_passenger.c lines as given by the passenger-install:
sudo nano /etc/apache2/mods-enabled/passenger.conf
In both config files outcomment the lines wich are installed automtically by Phusion Passenger.
Now let's edit the Webserver config as given by the passenger-install:
sudo nano /etc/apache2/sites-enabled/000-default.conf
And finally restart your Apache, and it should be up & running!
sudo service apache2 restart
See Dependencies
To date, Wagn has been developed and maintained primarily on Unix-based systems, especially Mac OS X. We will soon be improving this and adding strong Windows support. In the meantime, our generous users have contributed these helpful instructions for installation on systems where they've encountered issues with our default installation process:
Installing RubyVersionManager (RVM for short) and RUBY
Make sure you are logged in as your new 'your_user' (not root):
You'll need curl for this one, install it:
$ sudo apt-get install curl
Then type in:
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
* if you get a signature error type in the command below and try again:
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
** if you get a signature error again type this in and try again:
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
* more info at http://rvm.io/rvm/install
$ sudo apt-get install nodejs (needed when wagn update, complains about execjs)
Make sure bundler is the latest version
$ sudo gem install bundler
Installing ImageMagick
$ sudo apt-get install imagemagick
$ sudo apt-get install libmagickwand-dev
Installing an RDBMS
* parts taken form http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you//
install posgresql 9.4
mkdir install_pg
cd install_pg
wget https://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
sudo yum -y install http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
sudo yum -y groupinstall "PostgreSQL Database Server 9.4 PGDG"
check if everything was correctly installed
sudo rpm -qa | grep postgre
postgresql94-server-9.4.16-1PGDG.rhel7.x86_64
postgresql94-libs-9.4.16-1PGDG.rhel7.x86_64
postgresql94-9.4.16-1PGDG.rhel7.x86_64
postgresql94-contrib-9.4.16-1PGDG.rhel7.x86_64
enable & start service
sudo systemctl enable postgresql-9.4
sudo systemctl start postgresql-9.4.service
initialize database
sudo /usr/pgsql-9.4/bin/postgresql94-setup initdb
firewall adjustment (open ports)
firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
enable SELinux
setsebool -P httpd_can_network_connect_db 1
change password for the
sudo passwd postgres
(user prompted twice for a password)
edit the posgresql configuration file
vim /var/lib/pgsql/9.4/data/pg_hba.conf
Change from:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
To:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
posgresql 9.4 binaries (should set postgresql ENV!)
all postgresql 9.4 binaries are installed at /usr/pgsql-9.4/bin
Change password for the 'postgres' user
sudo passwd postgres
If root/sudo rights are unavailable use sudo:sudo -i -u postgres
at the prompt then enter:passwd
to change the user password
Decko installation
create a db user (asks for the password twice) will have to be written at the config/database.yml
# -d (--createdb) (role can create new databases)
# -P (--pwprompt) (assign a password to new role)
createuser -d <db_user> -P (CREATE ROLE alias)
create database which will have to be written at the config/database.yml
# probably not needed decko seed will create the database
# create database via user
# -O (--owner=OWner) (database user to own the new database)
# createdb -O <db_user> <database>
Edit Gemfile and add the pg
gem
gem 'pg', '~> 0.18'
edit config/database.yml
# Add this after the cucumber: *test line
production: &production
adapter: postgresql
encoding: utf8
reconnect: false
database: <database_name>
pool: 5
username: <db_user>
password: <db_user_password>
host: localhost
I'm fuzzy here on the profile (probably if you want to change to production then change it?)
@ethn could you please fill it here?profile: *production
What is the correct format for production deployment?
Now to install all gems and seed the application
install decko gem
gem install decko
install new application
decko new _app_name_
change directory
cd _app_name_
install all needed gems (this is probably optional but I'm used to doing it manually)
bundle install
prefill the DB and have the original configuration
decko seed
If everything went fine you should see:
bundle exec rake decko:seed
--> Database '<db_name>' already exists (This is extra as I had the database already)
not dropped
creating
loading schema
-- create_table("card_actions", {:id=>:integer, :force=>:cascade})
-> 0.0542s
-- create_table("card_acts", {:id=>:integer, :force=>:cascade})
-> 0.0250s
-- create_table("card_changes", {:id=>:integer, :force=>:cascade})
-> 0.0121s
-- create_table("card_references", {:id=>:integer, :force=>:cascade})
-> 0.0290s
-- create_table("card_revisions", {:id=>:integer, :force=>:cascade})
-> 0.0157s
-- create_table("cards", {:id=>:integer, :force=>:cascade})
-> 0.0571s
-- create_table("delayed_jobs", {:force=>:cascade})
-> 0.0146s
-- create_table("schema_migrations_core_cards", {:id=>false, :force=>:cascade})
-> 0.0095s
-- create_table("schema_migrations_deck_cards", {:id=>false, :force=>:cascade})
-> 0.0084s
-- create_table("sessions", {:id=>:integer, :force=>:cascade})
-> 0.0107s
-- create_table("users", {:id=>:integer, :force=>:cascade})
-> 0.0073s
update card_migrations
-- assume_migrated_upto_version("20170830210517", ["/home/smalltalk/.rvm/gems/ruby-2.3.0/gems/card-1.93.8/db/migrate_core_cards"])
-> 0.0321s
loading bootstrap
set symlink for assets
reset cache
Then you can start the built-in WEBrick server as mentioned at the https://github.com/decko-commons/decko/blob/master/decko/README.rdoc
You should see (when started correctly):
decko server
=> Booting Thin
=> Rails 5.1.4 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
Install the package:
# apt-get install mysql2
Try to install the gem
$ gem install mysql2
If you're planning on using the mysql2 gem for your application then you'll want to install the libmysqlclient-dev package before you do that. Without it, you'll get an error when the gem tries to compile its native extensions:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/home/ryan/.rubies/ruby-2.2.0/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Install this package using:
$ sudo apt-get install libmysqlclient-dev
If you are running mysql and rake complains about not being able to find your mysql.sock file, you will need to add "socket: " to each of the database definitions
Example database.yml for Development
development:
adapter: mysql
socket: /var/mysql/mysql.sock
database: wagn_development
username: wagn
password: hi_im_a_password_right_up_in_here
host: localhost
test:
adapter: mysql
socket: /var/mysql/mysql.sock
database: wagn_test
username: wagn
password: woo_hoo_password
host: localhost
production:
adapter: mysql
socket: /var/mysql/mysql.sock
database: wagn_production
username: wagn
password: password_ahoy
host: localhost
To be added.
To be added.
Installing a Web Server+On GNU Linux
Install a web server Nginx or Apache
To use a different webserver, please see Ruby on Rails documentation. (And let us know how it goes!)
Nginx and Passenger
You will need an http server to run your applications. Nginx is fast, lightweight and easy to configure and Phusion Passenger module makes Nginx and Rails integration painless. Firstly, install Passenger gem:
$ sudo gem install passenger
and then, install Nginx with compiled Passenger module:
$ sudo passenger-install-nginx-module
*depending on the system you are running the module needs ssl to work so read the instructions on screen to what it says, on Debian it was:
$ sudo apt-get install libcurl4-gnutls-dev
Choose the recommended install mode.
Now, open the Nginx configuration file (/opt/nginx/cong/nginx.conf if you haven’t changed it during installation).
$ sudo nano /opt/nginx/conf/nginx.conf
Let’s change some default config. Change worker_processes to be equal to number of CPU cores. You can also enable gzip compression. Just add following lines:
gzip on;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
* parts from http://karolgalanciak.com/blog/2013/07/19/centos-6-4-server-setup-with-ruby-on-rails-nginx-and-postgresql/
how to install nginx and apache in MacOS
to be added