Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ sudo add-apt-repository ppa:webupd8team/sublime-text-3
- $ sudo apt-get update
- $ sudo apt-get install sublime-text-installer
- ======================== sniff for laravel =================================
- How to install Laravel in Ubuntu 16.04
- basic stuff install (optional)
- sudo apt-get install git
- sudo apt-get install zip
- -->>LAMP
- sudo apt-get install tasksel
- sudo tasksel install lamp-server
- -->>CURL
- sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext
- -->>enable mods
- sudo phpenmod mcrypt
- sudo phpenmod mbstring
- sudo a2enmod rewrite
- sudo systemctl restart apache2
- -->>Install Composer
- curl -sS https://getcomposer.org/installer | php
- sudo mv composer.phar /usr/local/bin/composer
- -->>install phpmyadmin
- sudo apt-get install phpmyadmin
- later accessible through localhost/phpmyadmin
- Creating Laravel Project
- cd /var/www/html/
- sudo composer create-project laravel/laravel work --prefer-dist
- sudo chmod -R 777 work
- Creating Virtual Host work.com
- sudo gedit/etc/apache2/sites-available/work.com.conf
- and paste this inside that document
- #/etc/apache2/sites-available/work.com.conf contains following lines
- <VirtualHost *:80>
- ServerName work.com
- DocumentRoot /var/www/html/work/public
- <Directory /var/www/html/work/public>
- AllowOverride All
- Require all granted
- </Directory>
- </VirtualHost>
- enable that site
- sudo a2ensite work.com
- service apache2 reload
- fix hosts file so you can access it through webbrowser
- sudo gedit/etc/hosts
- #/etc/hosts contents following lines
- 127.0.0.1 work.com
- or use this command
- sudo -- sh -c "echo '\n127.0.0.1 \twork.com'>> /etc/hosts"
- That's it laravel is installed!
- ======================== end =======================================
- ======================== sniff for ruby on rails ===================
- Installing Ruby
- Choose the version of Ruby you want to install:
- The first step is to install some dependencies for Ruby.
- sudo apt-get update
- 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
- 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.
- cd
- wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
- tar -xzvf ruby-2.3.1.tar.gz
- cd ruby-2.3.1/
- ./configure
- make
- sudo make install
- ruby -v
- The last step is to install Bundler
- gem install bundler
- Installing Rails
- Choose the version of Rails you want to install:
- 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.
- To install NodeJS, we're going to add it using the official repository:
- curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
- sudo apt-get install -y nodejs
- And now, without further adieu:
- gem install rails -v 4.2.6
- rails -v
- Setting Up MySQL
- 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.
- 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.
- 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.
- sudo apt-get install mysql-server mysql-client libmysqlclient-dev
- 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.
- Final Steps
- And now for the moment of truth. Let's create your first Rails application:
- #### If you want to use SQLite (not recommended)
- rails new myapp
- #### If you want to use MySQL
- rails new myapp -d mysql
- #### If you want to use Postgres
- # Note that this will expect a postgres user with the same username
- # as your app, you may need to edit config/database.yml to match the
- # user you created earlier
- rails new myapp -d postgresql
- # Move into the application directory
- cd myapp
- # If you setup MySQL or Postgres with a username/password, modify the
- # config/database.yml file to contain the username/password that you specified
- # Create the database
- rake db:create
- rails server
- ======================== Done Here ===============================
- source https://gorails.com/setup/ubuntu/16.04
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement