Skip to content

Commit 2d34500

Browse files
authored
Merge pull request #64 from railsgirls/update-ubuntu-instructions
Update Ubuntu instructions
2 parents db0809d + 68ffa7c commit 2d34500

File tree

1 file changed

+42
-32
lines changed

1 file changed

+42
-32
lines changed

rails-install-ubuntu.sh

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,65 @@
11
#!/bin/bash
22

3+
set -eu
4+
35
if
46
[[ "${USER:-}" == "root" ]]
57
then
68
echo "This script works only with normal user, it wont work with root, please log in as normal user and try again." >&2
79
exit 1
810
fi
911

10-
set -e
11-
12-
echo "Updates packages. Asks for your password."
12+
echo "Update packages. Asks for your password. Please enter your password."
1313
sudo apt-get update -y
1414

15-
echo "Installs Node 10"
16-
sudo apt-get install -y snapd
17-
sudo snap install node --classic --channel=10
15+
echo "Install packages. Enter your password when asked."
16+
sudo apt-get --ignore-missing install build-essential git-core curl openssl libssl-dev libcurl4-openssl-dev zlib1g zlib1g-dev libreadline6-dev libyaml-dev libsqlite3-dev libsqlite3-0 sqlite3 libxml2-dev libxslt1-dev libffi-dev software-properties-common libgdm-dev libncurses5-dev automake autoconf libtool bison postgresql postgresql-contrib libpq-dev libc6-dev -y
1817

19-
echo "Installs packages. Give your password when asked."
20-
sudo apt-get --ignore-missing install build-essential git-core curl openssl libssl-dev libcurl4-openssl-dev zlib1g zlib1g-dev libreadline6-dev libyaml-dev libsqlite3-dev libsqlite3-0 sqlite3 libxml2-dev libxslt1-dev libffi-dev software-properties-common libgdm-dev libncurses5-dev automake autoconf libtool bison postgresql postgresql-contrib libpq-dev pgadmin3 libc6-dev -y
18+
echo "Install Node.js"
19+
sudo apt-get install -y snapd
20+
sudo snap install node --classic --channel=18
2121

22-
echo "Installs ImageMagick for image processing"
22+
echo "Install ImageMagick for image processing"
2323
sudo apt-get install imagemagick --fix-missing -y
2424

25-
echo "Installs RVM (Ruby Version Manager) for handling Ruby installation"
26-
# Retrieve the GPG key.
27-
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
28-
curl -sSL https://get.rvm.io | bash -s stable
29-
source ~/.rvm/scripts/rvm
25+
echo "Install rbenv (Ruby version manager) for handling the Ruby installation"
26+
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
3027

31-
echo "Installs Ruby"
32-
rvm install 3.1.2
33-
rvm use 3.1.2 --default
28+
RBENV_INSTALL_PATH="$HOME/.rbenv"
29+
if [ -d "$RBENV_INSTALL_PATH" ]; then
30+
echo "rbenv already installed"
31+
else
32+
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
33+
34+
echo "Configuring rbenv for your Shell"
35+
if [[ "$SHELL" == *"bash" ]]; then
36+
echo 'eval "$($HOME/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
37+
elif [[ "$SHELL" == *"zsh" ]]; then
38+
echo 'eval "$($HOME/.rbenv/bin/rbenv init - zsh)"' >> ~/.zshrc
39+
else
40+
echo "Unknown Shell. Please configure rbenv manually."
41+
echo "Please visit: https://github.com/rbenv/rbenv"
42+
fi
43+
fi
3444

45+
echo "Load rbenv config in install script"
46+
eval "$($HOME/.rbenv/bin/rbenv init - bash)"
47+
48+
echo "Install Ruby"
49+
RUBY_VERSION=3.1.3
50+
rbenv install "$RUBY_VERSION"
51+
rbenv global "$RUBY_VERSION"
52+
53+
echo "Install Rails"
3554
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
36-
gem install rails
55+
gem install bundler rails
3756

3857
echo -e "\n- - - - - -\n"
3958
echo -e "Now we are going to print some information to check that everything is done:\n"
4059

41-
42-
echo -n "Should be sqlite 3.22.0 or higher: sqlite "
60+
echo -n "Should be SQLite 3.22.0 or higher: sqlite "
4361
sqlite3 --version
44-
echo -n "Should be rvm 1.29.8 or higher: "
45-
rvm --version | sed '/^.*$/N;s/\n//g' | cut -c 1-11
46-
echo -n "Should be ruby 3.0 or higher: "
62+
echo -n "Should be Ruby 3.1.3 or higher: "
4763
ruby -v | cut -d " " -f 2
4864
echo -n "Should be Rails 7.0 or higher: "
4965
rails -v
@@ -55,12 +71,6 @@ and we will help you do the installation the manual way at the event.
5571
5672
Congrats!
5773
58-
Make sure that all works well by running the application generator command:
59-
$ rails new railsgirls
60-
61-
If you encounter the message:
62-
The program 'rails' is currently not installed.
63-
64-
It is just a hiccup with the shell, solutions:
65-
$ source ~/.rvm/scripts/rvm
66-
Allow login shell, example http://rvm.io/integration/gnome-terminal/"
74+
Open a new Terminal tab/window and make sure that all works well
75+
by running the application generator command:
76+
$ rails new railsgirls"

0 commit comments

Comments
 (0)