Advertisement
rama_astadipati

ubuntu 16 laravel and ruby on rails

Nov 16th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. $ sudo add-apt-repository ppa:webupd8team/sublime-text-3
  2. $ sudo apt-get update
  3. $ sudo apt-get install sublime-text-installer
  4.  
  5. ======================== sniff for laravel =================================
  6. How to install Laravel in Ubuntu 16.04
  7. basic stuff install (optional)
  8.  
  9. sudo apt-get install git
  10. sudo apt-get install zip
  11.  
  12. -->>LAMP
  13.  
  14. sudo apt-get install tasksel
  15. sudo tasksel install lamp-server
  16.  
  17. -->>CURL
  18.  
  19. sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext
  20.  
  21. -->>enable mods
  22.  
  23. sudo phpenmod mcrypt
  24. sudo phpenmod mbstring
  25. sudo a2enmod rewrite
  26. sudo systemctl restart apache2
  27.  
  28. -->>Install Composer
  29.  
  30. curl -sS https://getcomposer.org/installer | php
  31. sudo mv composer.phar /usr/local/bin/composer
  32.  
  33. -->>install phpmyadmin
  34.  
  35. sudo apt-get install phpmyadmin
  36.  
  37. later accessible through localhost/phpmyadmin
  38. Creating Laravel Project
  39.  
  40. cd /var/www/html/
  41. sudo composer create-project laravel/laravel work --prefer-dist
  42. sudo chmod -R 777 work
  43.  
  44. Creating Virtual Host work.com
  45.  
  46. sudo gedit/etc/apache2/sites-available/work.com.conf
  47.  
  48. and paste this inside that document
  49.  
  50. #/etc/apache2/sites-available/work.com.conf contains following lines
  51. <VirtualHost *:80>
  52. ServerName work.com
  53. DocumentRoot /var/www/html/work/public
  54.  
  55. <Directory /var/www/html/work/public>
  56. AllowOverride All
  57. Require all granted
  58. </Directory>
  59. </VirtualHost>
  60.  
  61. enable that site
  62.  
  63. sudo a2ensite work.com
  64. service apache2 reload
  65.  
  66. fix hosts file so you can access it through webbrowser
  67.  
  68. sudo gedit/etc/hosts
  69.  
  70. #/etc/hosts contents following lines
  71. 127.0.0.1 work.com
  72.  
  73. or use this command
  74.  
  75. sudo -- sh -c "echo '\n127.0.0.1 \twork.com'>> /etc/hosts"
  76.  
  77. That's it laravel is installed!
  78. ======================== end =======================================
  79.  
  80. ======================== sniff for ruby on rails ===================
  81. Installing Ruby
  82.  
  83. Choose the version of Ruby you want to install:
  84.  
  85. The first step is to install some dependencies for Ruby.
  86.  
  87. sudo apt-get update
  88. sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
  89.  
  90. Next we're going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you're familiar with rvm you can follow those steps as well. I've included instructions for installing from source as well, but in general, you'll want to choose either rbenv or rvm.
  91.  
  92. cd
  93. wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
  94. tar -xzvf ruby-2.3.1.tar.gz
  95. cd ruby-2.3.1/
  96. ./configure
  97. make
  98. sudo make install
  99. ruby -v
  100.  
  101. The last step is to install Bundler
  102.  
  103. gem install bundler
  104.  
  105.  
  106. Installing Rails
  107.  
  108. Choose the version of Rails you want to install:
  109.  
  110. Since Rails ships with so many dependencies these days, we're going to need to install a Javascript runtime like NodeJS. This lets you use Coffeescript and the Asset Pipeline in Rails which combines and minifies your javascript to provide a faster production environment.
  111.  
  112. To install NodeJS, we're going to add it using the official repository:
  113.  
  114. curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
  115. sudo apt-get install -y nodejs
  116.  
  117. And now, without further adieu:
  118.  
  119. gem install rails -v 4.2.6
  120.  
  121. rails -v
  122.  
  123. Setting Up MySQL
  124.  
  125. Rails ships with sqlite3 as the default database. Chances are you won't want to use it because it's stored as a simple file on disk. You'll probably want something more robust like MySQL or PostgreSQL.
  126.  
  127. There is a lot of documentation on both, so you can just pick one that seems like you'll be more comfortable with. If you're coming from PHP, you may already be familiar with MySQL. If you're new to databases, I'd suggest skipping to setting up PostgreSQL.
  128.  
  129. You can install MySQL server and client from the packages in the Ubuntu repository. As part of the installation process, you'll set the password for the root user. This information will go into your Rails app's database.yml file in the future.
  130.  
  131. sudo apt-get install mysql-server mysql-client libmysqlclient-dev
  132.  
  133. Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.
  134.  
  135. Final Steps
  136.  
  137. And now for the moment of truth. Let's create your first Rails application:
  138.  
  139. #### If you want to use SQLite (not recommended)
  140. rails new myapp
  141.  
  142. #### If you want to use MySQL
  143. rails new myapp -d mysql
  144.  
  145. #### If you want to use Postgres
  146. # Note that this will expect a postgres user with the same username
  147. # as your app, you may need to edit config/database.yml to match the
  148. # user you created earlier
  149. rails new myapp -d postgresql
  150.  
  151. # Move into the application directory
  152. cd myapp
  153.  
  154. # If you setup MySQL or Postgres with a username/password, modify the
  155. # config/database.yml file to contain the username/password that you specified
  156.  
  157. # Create the database
  158. rake db:create
  159.  
  160. rails server
  161.  
  162. ======================== Done Here ===============================
  163. source https://gorails.com/setup/ubuntu/16.04
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement