Install Rails, MarieDB and phpmyadmin

This assumes you have Ruby running from: https://gorails.com/setup/ubuntu/22.04

Install Ruby

sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-devCode language: JavaScript (javascript)

Install ASDF:

cd
git clone https://github.com/excid3/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
echo 'export EDITOR="code --wait"' >> ~/.bashrc
exec $SHELLCode language: PHP (php)

Install plugins:

asdf plugin add ruby
asdf plugin add nodejs

Install Ruby:

asdf install ruby 3.3.0
asdf global ruby 3.3.0

# Update to the latest Rubygems version
gem update --systemCode language: CSS (css)

Insstall NodeJS:

asdf install nodejs 20.11.0
asdf global nodejs 20.11.0

which node
#=> /home/username/.asdf/shims/node
node -v
#=> 20.11.0

# Install yarn for Rails jsbundling/cssbundling or webpacker
npm install -g yarnCode language: PHP (php)

Configure Git:

git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"Code language: PHP (php)

Create RSA key and put on github

ssh-keygen -t rsa -b 4096 -C "you@kenyon.edu"
cat ~/.ssh/id_rsa.pubCode language: JavaScript (javascript)

Copy key. Go into settings on github.com, select SSH keys. Add the key.

Install Rails:

gem install rails -v 7.1.3Code language: CSS (css)

Check:

rails -v
# Rails 7.1.3Code language: CSS (css)

Install MySQL

sudo apt update
sudo apt install mariadb-server
sudo mysql_secure_installation

Enter return for no current password.

Enter “Y” for unix_socket authentication.

Enter “y” to change the root password to something you will remember (you will need this often)

Remove anonymous users? Y

Disallow root login remotely? N

Remove test database and access to it? [Y/n] n

Reload privilege tables now? [Y/n] n

mysql -u root -p

You should be able to login with your new password.

If not installed, install apache:

sudo apt install apache2

Install Mysql development component:

sudo apt install libmariadb-dev

Install phpmyadmin

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
sudo apt install libapache2-mod-php7.4 Code language: CSS (css)

Select apache2

Answer yes to configure database

Enter your mysql root password

sudo nano /etc/apache2/apache2.conf 

Add at bottom:

Include /etc/phpmyadmin/apache.confCode language: PHP (php)

New do:

sudo service apache2 restart

See if it work with:

http://<em>yourvmipaddress</em>/phpmyadminCode language: HTML, XML (xml)

Log in as root.

Now add a non-root user to the database, and grant it permissions: (Change youruser and yourpassword to your own values)

mysql -u root -p
CREATE USER 'youruser'@'%' IDENTIFIED BY 'yourpassword';
GRANT SELECT, INSERT, CREATE, ALTER, DROP, LOCK TABLES, CREATE TEMPORARY TABLES, DELETE, UPDATE, INDEX, EXECUTE ON *.* TO 'youruser'@'%';
exit;Code language: PHP (php)

Now use phpmyadmin to log in as your new user, and create a new database.

Scroll to Top