This repository is provided as an auxiliary guide to run all the software used in the AID 2022 Course @ Tecnico on Apple Silicon Macs when needed. If you are using x86-64 you are better off using the Virtual Machine AID_2022 you can STOP reading here!
In one hand, this guide will help you run MySQL server using Docker to keep it somewhat independent of any other software you have installed on your system.
On the other hand, the current version of this guide recommends the installation of Pentaho server and client-tools in your chosen directory.
Note: The lab guides were not updated to reflect this setup. The provided VM is still the recommended setup for this course.
You should have Homebrew installed on your system before following this guide.
-
Follow the instructions here: Install Homebrew
-
Install your first package
$ brew install git
-
Open a Terminal window and move to your directory of choice
-
$ git clone https://github.com/flaviomartins/2022-aid.git
-
Open a Terminal window and move into this repo
-
$ cd yourpath/2022-aid/
-
$ docker-compose up
-
Keep the Terminal window open whenever you need access to the db.
-
Open another Terminal window to run mysql client after moving to the data directory.
-
docker-compose exec db bash -c "cd /tmp/data/ && mysql -u aid -p"
-
Enter the the password: aid
-
Lets try to list the data/ files. Run
mysql> system ls -l
to list the files.
MyCLI is a command line interface for MySQL, MariaDB, and Percona with auto-completion and syntax highlighting.
You can opt to run MyCLI instead of mysql
client for the improvements in ease of use.
$ docker-compose run mycli -h db -u aid -p aid
MySQL Workbench is crashing on the Apple Silicon Macs.
-
Visit the Adminer page
-
Enter the credentials
-
Open Sequel Ace
-
Enter the credentials
-
brew install openjdk@11
-
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
-
brew install jenv
-
To activate jenv, add the following to your
~/.zshrc
:export PATH="$HOME/.jenv/bin:$PATH" eval "$(jenv init -)"
On a new Terminal window the command jenv
is available
-
$ jenv add /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/
-
$ jenv global 11.0
-
$ jenv shell 11.0
-
$ java -version
should display something like the following:openjdk version "11.0.16.1" 2022-08-12 OpenJDK Runtime Environment Homebrew (build 11.0.16.1+0) OpenJDK 64-Bit Server VM Homebrew (build 11.0.16.1+0, mixed mode)
Rosetta 2 enables a Mac with Apple silicon to use apps built for a Mac with an Intel processor.
- Run
$ softwareupdate --install-rosetta
in a Terminal window.
Here is how you can force the shell to run in Intel mode so that you can continue working in this little command-line Rosetta Island while waiting for native ARM64 support.
-
Open the Terminal app.
-
Open the Terminal app’s Preferences.
-
Click on the Profiles tab.
-
Select a profile, click on the ellipsis at the bottom of the profile list and then select Duplicate Profile.
-
Click on the new profile and give it a good name. I named mine as “Terminal (Intel)”.
-
Also in the new profile, click on the Window tab. In the Title, put a name to indicate that this is for running Intel-based apps. I put “Terminal (Intel)” on mine.
-
Click on the Shell tab and use the following as its Run Command to force the shell run under Rosetta:
env /usr/bin/arch -x86_64 /bin/zsh --login
-
Untick the Run inside shell checkbox. Clearing the checkbox would prevent running the shell twice, which could bloat your environment variables since
~/.zshrc
gets run twice.
-
Consult the Software List
-
Download the necessary Pentaho client-tools
-
Create a home directory
~/Pentaho/
to install the tools. -
Most tools seem to run if launched from the
Terminal (Intel)
profile with the exception of PDI. Lets fix that next.
-
The PDI tool should be installed at
~/Pentaho/data-integration/
. -
To run on Apple Silicon we need to replace the bundled version of SWT at
~/Pentaho/data-integration/libswt/osx64/swt.jar
with theswt.jar
foraarch64
inside this zip swt-4.26M1-cocoa-macosx-aarch64.zip -
Now open a Terminal window and switch to the
Terminal (Intel)
profile and move into the directory of PDI$ cd ~/Pentaho/data-integration/
. -
You can now run PDI with
$ ./spoon.sh
. -
Do not forget to install the mysql-connector-java driver. Copy the
.jar
file inside the ZIP to the~/Pentaho/data-integration/lib/
directory. When adding a new Database connection select MySQL and then JDBC (native).
We just need to add the JDBC MySQL Connector Driver to the Schema Workbench lib/
directory and use a different class name. Just follow the instructions here.
-
Do not forget to install the mysql-connector-java driver. Copy the
.jar
file inside the ZIP to the~/Pentaho/schema-workbench/lib/
directory. -
Create a new
Database connection
inOptions -> Connection...
and enter the desired name. -
For the
Connection type
selectGeneric database
andJDBC (native)
. -
For the
Custom connection URL
enterjdbc:mysql://localhost/mydatabase
. -
For the
Custom driver class name
entercom.mysql.cj.jdbc.Driver
. -
Enter the username
aid
and passwordaid
as per usual. -
Click
Test
to check if a connection is made.
-
Download latest DataCleaner (Community Edition)
-
Unzip it into
~/Pentaho/
and it will create the~/Pentaho/DataCleaner/
directory. -
$ cd ~/Pentaho/DataCleaner/
-
$ ./datacleaner.sh
-
Installing database drivers in DataCleaner desktop is done in the application itself while it is running.
-
Download the necessary Pentaho server
-
The Pentaho Server should be installed at
~/Pentaho/pentaho-server/
-
Add
export PENTAHO_JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home"
to~/.zshrc
to force OpenJDK 11. -
Also, add a line with
export JAVA_HOME
beforesh startup.sh
on thestart-pentaho.sh
script so thestartup.sh
script picks the variable up:
export JDK_JAVA_OPTIONS
JAVA_HOME=$_PENTAHO_JAVA_HOME
export JAVA_HOME
sh startup.sh
fi
-
Open a new Terminal window move to
cd ~/Pentaho/pentaho-server/
and run./start-pentaho.sh
.
Submit and issue if you have one for me. Also, if you can help me improve this guide send a pull request!
Good luck!
Flávio