└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Ubuntu Environment Setup 2 | 3 | ## Setting up your Ubuntu Developer Environment 4 | 5 | In this readme we are going to go over the steps for setting up your development environment in Ubuntu. Specifically, we wrote these instructions with Ubuntu 18.04 in mind using the MATE Desktop Environment 1.20.1. 6 | 7 | First off: **you need to be a user with `sudo` access to perform this setup**. You can check to see if you have sudo access by typing `sudo echo ok` in your terminal. If you get back `ok`, then you have the correct access. 8 | 9 | We also want to make sure that your terminal is set to be a login shell. Setting your terminal to a login shell ensures that our .bash_profile will be run. In Ubuntu, open up your terminal, select Edit > Profile Preferences. Then on the Command tab, check off 'Run command as login shell'. 10 | 11 | ## Set up group 12 | 13 | He we are setting up a group with the name "npm". This is so that we can set reasonable permissions on packages that get installed via npm (more on permissions and npm later). These permissions ensure that we can globally install npm packages. 14 | 15 | - `sudo groupadd npm` 16 | - `sudo usermod -a -G npm,staff $USER` 17 | 18 | ## Make sure everything is up to date 19 | 20 | Before we start installing all of our developer tools, we want to make sure that everything is up to date. For this, we're going to use the `apt-get` Linux package manager to update everything using the following commands: 21 | 22 | - `sudo apt-get update` 23 | - `sudo apt-get upgrade` 24 | - `sudo apt-get dist-upgrade` (this one is optional) 25 | 26 | ## Installing Dev tools 27 | 28 | ### The essentials 29 | 30 | Now we can install some essential dev tools (postgres, node...) using curl: 31 | 32 | - `sudo apt-get -y install curl postgresql libpq-dev default-jre build-essential phantomjs` 33 | - `curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -` 34 | - `sudo apt-get install nodejs` 35 | 36 | ### The non-essentials: 37 | 38 | - `sudo apt-get -y install ack-grep vim libgnome2-bin` 39 | 40 | You can also install a few non-essential tools (ack-grep, vim, and libgnome) if you like: 41 | 42 | - [ack-grep](http://beyondgrep.com/) - A more advanced tool to take the place of the `grep` (search) command in the terminal 43 | - [vim](https://en.wikipedia.org/wiki/Vim_(text_editor)) - A terminal based text editor 44 | - [libgnome2-bin](https://developer.gnome.org/about/about.html.en) - Provides documentation for the GNOME desktop environment and acts as a handy open tool. 45 | 46 | ## Setting file permissions 47 | 48 | To be able to properly use some of these tools, we need to manually set some of the permissions and owners of some of the recently installed files: 49 | 50 | - `sudo chown root:staff /usr/bin` 51 | - `sudo chmod 0775 /usr/bin` 52 | - `sudo chown -R root:npm /usr/lib/node_modules` 53 | - `sudo chmod 0775 /usr/lib/node_modules` 54 | 55 | If you're curious, you can read more about `chmod` (setting permissions) and `chown` (setting the owner) here: http://www.unixtutorial.org/2014/07/difference-between-chmod-and-chown/ 56 | Take a look at [this page](http://www.perlfect.com/articles/chmod.shtml) if you want to understand the permission values (0755, 0600, ...) 57 | 58 | ## Set up .netrc file for the learn gem 59 | 60 | The learn gem needs this netrc file to work. The `.netrc` file is a standard location to store login/token info, so it is we store information needed for Learn. 61 | 62 | - `touch ~/.netrc && chmod 0600 ~/.netrc` 63 | 64 | ## Installing RVM 65 | 66 | [RVM](https://en.wikipedia.org/wiki/Ruby_Version_Manager) is a great tool that lets you run different versions of Ruby on your computer. This is really useful because if you know one project your working on works with Ruby version 2.3.1 and another needs 2.6.1, you can easily switch between the two versions when you switch between projects. You can install it and set it up with the following commands: 67 | 68 | - `gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3` 69 | - `\curl -sSL https://get.rvm.io | bash` 70 | - `echo "[[ -s "$HOME/.rvm/scripts/rvm" ]]" && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*"` 71 | - `rvm install 2.6.1` 72 | - `rvm use 2.6.1 --default` 73 | 74 | You can easily install different Ruby verions with `rvm install `, switch between versions with `rvm use ` and check to see which you've already installed with `rvm list`. You can always check what version your current terminal window is with `ruby -v`. 75 | 76 | ## Setting up (and getting) Ruby gems 77 | 78 | If your familiar with any other program language, [Ruby gems](https://en.wikipedia.org/wiki/RubyGems) are like libraries. If you're not familiar with programing libraries, it's basically isolated chunks of code that you can easily add to your project. For example, the `learn-co` gem allows you to easily interface with Learn from your command line (opening and submitting labs among many other things). 79 | 80 | To set up your gems and install some necessary ones, run the following commands: 81 | 82 | - `echo "gem: --no-ri --no-rdoc" > $HOME/.gemrc` 83 | - `gem update --system` 84 | - `gem install learn-co` 85 | - `gem install phantomjs` 86 | - `gem install pg` 87 | - `gem install sqlite3` 88 | - `gem install bundler` 89 | - `gem install rails` 90 | 91 | ## Installing a Node Pacakge 92 | 93 | One thing you'll see more of later in the course is npm, or [Node Package Manager](https://en.wikipedia.org/wiki/Npm_(software)). This is very similar to Ruby gems, but it's for JavaScript. 94 | 95 | - `sudo npm install -g n` 96 | 97 | ## Setting up your computer up with Github 98 | 99 | All of this courses content is stored on Github so you're going to have to do a lot of cloning (copying files from your github account to your computer) and pushing (taking files you've saved on your computer, and updating your github files with them). 100 | 101 | It would be a real pain if you have to type your password in every time you wanted to perform one of these actions. Luckily you don't have to with an SSH key. You can set this up by following the following steps: 102 | 103 | - `ssh-keygen` (ONLY DO THIS IF YOU DON'T ALREADY HAVE A GENERATED SSH KEY: just press return for everything, and don't enter a passphrase) 104 | - `cat ~/.ssh/id_rsa.pub`. This will disply the output of your SSH key to your terminal. You can then copy that, and add as ssh key on github by following the [instructions posted on github](https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/). Note: The first step in these instructions is _the same_ as doing the `cat ~/.ssh/id_rsa.pub` command and manually copying the text. 105 | - You're also going to want to let the git that is running on your machine to know you you are. You can set this up by running: `git config --global user.email "you@example.com"` and `git config --global user.name "Your Name"` 106 | 107 | ## Configure the Learn-Co gem 108 | 109 | Now that you have most of your tools installed, you're going to want to configure your learn-co gem. As previously mentioned, this gem lets you run tests, open labs, submit them, and save them to finish later. You can configure the gem to your account by using the following command: 110 | 111 | - `learn whoami` 112 | - Enter OAuth token when asked 113 | - If you have connected your Github account to your Learn account, navigate to learn.co/your_github_username. The OAuth token is at the bottom of the page. 114 | - If you have not connected your Github account: Go to [your profile](https://learn.co/account/profile) > Learn Settings > Public Profile. Click on the link under **Username**. The OAuth token is at the bottom of the page. 115 | 116 | You can find your oauth token at the bottom of your profile page. 117 | 118 | Once you submit your oauth token, the command should return with your Name, Username, Email, and your Learn Directory. Take note of where your Learn Directory is located. You will find a `~/.learn-config` file that also has the location of the Learn Directory. 119 | 120 | ## Opening the Learn-Co labs in a Native IDE environment. 121 | 122 | Currently, there is no Learn-Co IDE available for Linux, so you will work in a native environment. When you have a lab available to work on, you can find CLI instructions for workin with the lab system in this document: https://github.com/learn-co-curriculum/opening-a-lab-osx. Even though the document is for OSX, the commands are the same. It will show you how to use native `git` commands and how to use the `learn` command you installed in a previous step. 123 | 124 | 125 | ## Optional Dotfiles 126 | 127 | These dotfiles do a variety of different things and I highly recomend you download them. 128 | 129 | - `curl "https://raw.githubusercontent.com/flatiron-school/dotfiles/master/irbrc" -o "$HOME/.irbrc"` - This file gives you some nice formatting for when you're in IRB (IRB lets you write ruby code in your terminal) 130 | - `curl "https://raw.githubusercontent.com/flatiron-school/dotfiles/master/ubuntu-gitignore" -o "$HOME/.gitignore"` - Global .gitignore rules. When you add a .gitignore file to a project, it let's you specify certain files that you DO NOT want pushed up to github (like API keys...) 131 | - `curl "https://raw.githubusercontent.com/flatiron-school/dotfiles/master/linux_bash_profile" -o "$HOME/.bash_profile"` - Your bash profile loads up every time you open a terminal window. The Learn bash_profile is designed to load up a bunch of shortcuts for you as well as make sure that RVM loads up every time you open the terminal. I recommend you take a look at this file and even see if there are any shortcuts of your own that you'd like to add! Note: this will overwrite existing bash profile, so back up if you want to. 132 | - `curl "https://raw.githubusercontent.com/flatiron-school/dotfiles/master/linux_gitconfig" -o "$HOME/.gitconfig"` then `nano $HOME/.gitconfig` and edit what needs to be edited (github username and github email in a few places) 133 | 134 | ## Download Chrome and some other useful apps 135 | 136 | ### Chrome - Essential 137 | 138 | The Google Chrome browser is the required browser for Learn. You can download and install it by going to www.google.com/chrome. 139 | 140 | ### Zoom Client 141 | 142 | You're going to want to download and install Zoom for Ubuntu [here](https://zoom.us/download?os=linux). This is the tool we use at learn to screen share! Download the .deb file, then right click and open with the GDebi Package Installer. 143 | 144 | ### Atom - Essential (or at least _some_ code editor) 145 | 146 | Atom is github's hackable code editor. It's got tons of great tools for writting code. You can get it by following [these instructions](https://github.com/atom/atom#debian-linux-ubuntu) 147 | 148 | ### Slack for Linux 149 | 150 | If you're not already familiar with Slack, it is a messaging app that is widely used in many tech companies and it is heavily used by the Learn community for students to chat and stay in touch with each other. If you're going through Learn, you should be on Slack. 151 | 152 | `sudo apt-get install slack-desktop ` 153 | --------------------------------------------------------------------------------