You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -113,24 +123,37 @@ The `src/config/supported_distros.py` must now be updated to reflect the new jso
113
123
### Step 6: Install and populate the SQL database
114
124
115
125
#### Install dependencies and complete the secure installation. Remember the root password you set, you will need this in the future.
126
+
```bash
127
+
sudo apt install mariadb-server python3-pymysql
128
+
sudo mysql_secure_installation
129
+
```
116
130
117
-
sudo apt install mariadb-server python3-pymysql
118
-
sudo mysql_secure_installation
131
+
***NOTE:***
132
+
- If you encounter the following error when running `sudo mysql_secure_installation`:
133
+
```bash
134
+
Enter current password for root (enter for none):
135
+
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)
136
+
```
137
+
It means the MariaDB service is not running. Start it with:
138
+
```bash
139
+
sudo service mariadb start
140
+
```
119
141
120
142
#### Log in to MariaDB with the root account you set and create the read-only user (with a password, changed below) and database.
143
+
```bash
144
+
# Log in to MariaDB with the root account you set.
145
+
mariadb -u root -p
121
146
122
-
# Log in to MariaDB with the root account you set.
123
-
mariadb -u root -p
124
-
125
-
# Create the read-only user
126
-
MariaDB> CREATE USER 'sdtreaduser'@'localhost' IDENTIFIED BY 'SDTUSERPWD'; # Replace 'SDTUSERPWD' with the desired password.
147
+
# Create the read-only user
148
+
MariaDB> CREATE USER 'sdtreaduser'@'localhost' IDENTIFIED BY 'SDTUSERPWD'; # Replace 'SDTUSERPWD' with the desired password.
127
149
128
-
# Grant permissions.
129
-
MariaDB> GRANT SELECT ON sdtDB.* TO 'sdtreaduser'@'localhost';
150
+
# Grant permissions.
151
+
MariaDB> GRANT SELECT ON sdtDB.* TO 'sdtreaduser'@'localhost';
130
152
131
-
# Apply changes and exit.
132
-
MariaDB> flush privileges;
133
-
MariaDB> quit
153
+
# Apply changes and exit.
154
+
MariaDB> flush privileges;
155
+
MariaDB> quit
156
+
```
134
157
135
158
***NOTE:***
136
159
- For enhanced security, it's recommended to grant the software-discovery-tool user (sdtreaduser) only read (SELECT) permissions on the required database. This adheres to the principle of least privilege and minimizes the impact if the user credentials are compromised.
@@ -144,19 +167,29 @@ The `src/config/supported_distros.py` must now be updated to reflect the new jso
144
167
See `.env.example` and create a `.env` file in`/opt/software-discovery-tool/`, replacing the value of `DB_PASSWORD` with your own.
145
168
146
169
#### Run the script to populate the database, when prompted by the script for a user and password, use the root account and password you set above.
147
-
148
-
cd /opt/software-discovery-tool/bin/
149
-
./database_build.py
150
-
170
+
```bash
171
+
cd /opt/software-discovery-tool/bin/
172
+
./database_build.py
173
+
```
174
+
***NOTE:***
175
+
- If you encounter the following error:
176
+
```bash
177
+
pymysql.err.OperationalError: (1698, "Access denied for user 'root'@'localhost'")
178
+
```
179
+
Then give access to root user using:
180
+
```bash
181
+
mariadb -u root -p
182
+
MariaDB> ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('password');# Replace the 'password' with the root password you set while installing mariadb.
183
+
```
151
184
### Step 7: Verify that the software-discovery-tool server is up and running
152
185
We now run the following commands to properly enable the config files of the software-discovery-tool server and then restart the apache server.
153
-
154
-
sudo a2ensite z-000-default.conf
155
-
systemctl reload apache2
156
-
sudo a2ensite sdt.conf
157
-
systemctl reload apache2
158
-
sudo apachectl restart
159
-
186
+
```bash
187
+
sudo a2ensite z-000-default.conf
188
+
systemctl reload apache2
189
+
sudo a2ensite sdt.conf
190
+
systemctl reload apache2
191
+
sudo apachectl restart
192
+
```
160
193
We can check if the server is up and running by going to following URL :
The `REACT_APP_API_URL` variable is now set and will be used by your React application to communicate with the Flask server running at the specified URL.
0 commit comments