SPRING FRAMEWORK INSTALLING COMPONENTS ON macOS
This is the machine on which I will teach the course, I actually own a MacBookPro with macOS Sonoma 14.1 installed, Apple Silicon M2 Memory 8GB chip and 512 GB SSD. Both MySQL Server and MySqlWorkbench are available on the Mac, reasoning that I will be using this DBMS. However, I will show you how it is possible to have SQL Server on Mac by leveraging a Docker container and how all server management is simplified through the use of Azure Data Studio. Let’s start with the installation of the various components.
JDK INSTALLATION
Go with your favorite browser to the following address:
https://www.oracle.com/it/java/technologies/downloads/ – jdk21-mac
Select the version for your architecture. In my case the ARM 64 DMG file. Installation is very simple, is done via a graphical interface, and only a few steps are needed. Verify that everything has been installed correctly. Open the terminal and type:
java –version
INSTALLATION OF APACHE MAVEN
Go to the following address:
https://maven.apache.org/download.cgi
Download the binary zipper file and unzip it into a folder. I within the documents folder created another folder and called it Development. Here I unpacked the binary file. After extracting the file and saving it in your own folder we need to set two environment variables. The one for the Maven path bin and a JAVA_HOME variable. Open the terminal and type the following commands
sudo nano ~/.zshrc
export MVN_HOME=<<PATH FOLDER MAVEN>>
export PATH=$MVN_HOME/bin:$PATH
Finally, type mvn -v to see if Maven was installed correctly. If you have problems with permissions read this article.
Basically you have to move the contents of the folder to the unrestricted /usr/local path and update the PATH by having it point to the new location.
INSTALLATION OF APACHE TOMCAT
Go to the following address:
https://tomcat.apache.org/download-90.cgi
Download the zipper version of the file, and extract it to your own folder. Open the terminal and place it in the bin folder. Assign permissions to all files having the .sh extension with the following command:
chmod +x *.sh
run the web server run the command startup.sh, Tomcat will be run at the following address:
http://localhost:8080
To shut down Tomcat run the command shutdown.sh.
INSTALLATION OF SPRING TOOL SUITE
With your browser, go to the following address:
Download the version for your architecture. Copy the dmg file to the application folder and launch the program.
CONFIGURATION OF SPRING TOOL SUITE
The video illustrates the procedure. You must also install from the Eclipse Marketplace, found under the Help menu item, the following software components.
- Eclipse Enterprise Java and Web Developer Tools 3.31
- Eclipse Web Developer Tools 3.31
MYSQL DATABASE RECOVERY
Open MySqlWorkbench and make sure MySQL is running on port 3306. You will first see how to create a connection to the DBMS and restore the script. The video illustrates the procedure.
USING SQL SERVER AS A DBMS ON MAC
Let’s install Docker. Go to the following address and download the version for your architecture.
https://www.docker.com/get-started/
Copy the dmg file to the Applications folder.
Open the terminal and type the following commands, after starting Docker.
docker pull mcr.microsoft.com/azure-sql-edge
Wait for completion, then type:
sudo docker run –cap-add SYS_PTRACE -e ‘ACCEPT_EULA=1’ -e ‘MSSQL_SA_PASSWORD=bigStrongPwd’ -p 1433:1433 –name sqledge -d mcr.microsoft.com/azure-sql-edge
Change bigStrongPwd to the strong password you want to assign to user sa (Super Administrator). Type in
docker ps to see the created container. Run the container with the following command:
docker start sqledge
You can see everything through the user interface of the Docker application. Once we have the container running, we need to download Azure Data Studio to manage the newly created server. This is the link:
Launch the program. The following video shows how to use and connect to SQL Server.
Now we need to bring the SQL Server backup file into the container and restore the database. In the terminal, type the following command:
sudo docker exec -it sqledge mkdir /var/opt/mssql/backup
sudo docker cp “path file .bak” sqledge:/var/opt/mssql/backup
Such a command will copy the backup file Alphashop.bak to the /var/opt/mssql/backup container path. Now let’s restore the database. The following video shows how to do it.
DOWNLOAD SQL MYSQL SCRIPTS
The SQL Server backup file download can be found in the article “installing components in a Windows environment.”
Leave A Comment