[root@node1 ~]# yum install http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm -y
[root@node1 ~]# yum install mysql-server -y
[root@node1 ~]# systemctl start mysqld
[root@node1 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]
… Success!
Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
… Success!
By default, MySQL comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]
– Dropping test database…
ERROR 1008 (HY000) at line 1: Can’t drop database ‘test’; database doesn’t exist
… Failed! Not critical, keep moving…
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]
… Success!
All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up…
[root@node1 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.6.38 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)
mysql> SHOW GLOBAL VARIABLES LIKE ‘storage_engine’ ;
+—————-+——–+
| Variable_name | Value |
+—————-+——–+
| storage_engine | InnoDB |
+—————-+——–+
1 row in set (0.00 sec)
mysql> CREATE USER ‘sonarqube’@’localhost’ IDENTIFIED BY ‘password’;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE DATABASE sonarqube;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON sonarqube.* TO ‘sonarqube’@’localhost’;
Query OK, 0 rows affected (0.00 sec)
[root@node1 ~]# vim /etc/my.cnf
query_cache_size = 15M
[root@node1 ~]# cd /opt
[root@node1 opt]# wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.0.zip
[root@node1 opt]# yum install unzip -y
[root@node1 opt]# ls -l
total 123508
-rw-r–r–. 1 root root 126471115 Aug 3 2016 sonarqube-6.0.zip
[root@node1 opt]# unzip sonarqube-6.0.zip
Archive: sonarqube-6.0.zip
[root@node1 opt]# cd sonarqube-6.0
[root@node1 sonarqube-6.0]# ls
bin conf COPYING data extensions lib logs temp web
[root@node1 sonarqube-6.0]# vim conf/sonar.properties
sonar.jdbc.username=sonarqube
sonar.jdbc.password=password
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.web.host=0.0.0.0
sonar.web.port=9000
[root@node1 sonarqube-6.0]# cd bin/linux-x86-64/
[root@node1 linux-x86-64]# ls
lib sonar.sh wrapper
[root@node1 linux-x86-64]# ./sonar.sh start
Starting SonarQube…
Started SonarQube.
[root@node1 sonarqube-6.0]# netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1091/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1117/master
tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN 1075/java
tcp6 0 0 :::3306 :::* LISTEN 28629/mysqld
tcp6 0 0 127.0.0.1:42000 :::* LISTEN 1203/java
tcp6 0 0 :::8080 :::* LISTEN 15367/java
tcp6 0 0 :::34545 :::* LISTEN 1203/java
tcp6 0 0 :::43954 :::* LISTEN 1097/java
tcp6 0 0 :::22 :::* LISTEN 1091/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1117/master
tcp6 0 0 :::33663 :::* LISTEN 1141/java
tcp6 0 0 :::9000 :::* LISTEN 1141/java
tcp6 0 0 127.0.0.1:9001 :::* LISTEN 1097/java
[root@node1 sonarqube-6.0]# vim /etc/init.d/sonar
#!/bin/sh
/usr/bin/sonar $*
[root@node1 sonarqube-6.0]# ln -s /opt/sonarqube-6.0/bin/linux-x86-64/sonar.sh /usr/bin/sonar
[root@node1 sonarqube-6.0]# chmod 755 /etc/init.d/sonar
[root@node1 sonarqube-6.0]# service sonar status
SonarQube is running (1073).
default user/password: admin/admin

mysql> SELECT User, Host, Password FROM mysql.user;
+———–+———–+——————————————-+
| User | Host | Password |
+———–+———–+——————————————-+
| root | localhost | *4573E04F7C9FE39EE4726C623344975F81C132A6 |
| root | 127.0.0.1 | *4573E04F7C9FE39EE4726C623344975F81C132A6 |
| root | ::1 | *4573E04F7C9FE39EE4726C623344975F81C132A6 |
| sonarqube | localhost | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+———–+———–+——————————————-+
4 rows in set (0.00 sec)
mysql> use sonarqube;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+—————————+
| Tables_in_sonarqube |
+—————————+
| active_dashboards |
| active_rule_parameters |
| active_rules |
| activities |
| authors |
| ce_activity |
| ce_queue |
| dashboards |
| duplications_index |
| events |
| file_sources |
| group_roles |
| groups |
| groups_users |
| issue_changes |
| issue_filter_favourites |
| issue_filters |
| issues |
| loaded_templates |
| manual_measures |
| measure_filter_favourites |
| measure_filters |
| metrics |
| notifications |
| perm_templates_groups |
| perm_templates_users |
| perm_tpl_characteristics |
| permission_templates |
| project_links |
| project_measures |
| project_qprofiles |
| projects |
| properties |
| quality_gate_conditions |
| quality_gates |
| resource_index |
| rules |
| rules_parameters |
| rules_profiles |
| schema_migrations |
| snapshots |
| user_roles |
| user_tokens |
| users |
| widget_properties |
| widgets |
+—————————+
46 rows in set (0.00 sec)
