一、搭建MySQL8
参考链接:https://blog.csdn.net/jdbdh/article/details/92840742
(1)检查依赖:
Deepin15.11默认情况下已经安装了libaio1,执行如下命令:
sudo apt install libaio1
注:如果已经安装,将自动忽略
(2)下载安装包
可通过如下命令(注意:如果curl命令没有,可通过sudo apt install curl安装curl):
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz -O
或者访问网址https://dev.mysql.com/downloads/mysql/
注:经实测8.0.16版本可正常安装,8.0.18有问题,推荐使用前者;
(3)解压安装包
tar -xJvf mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz
注:上述命令以下载到当前目录为例,请以实际情况为准
(4)移动解压后的目录到/usr/local目录
sudo mv ./mysql-8.0.16-linux-glibc2.12-x86_64 /usr/local/mysql
注:目标目录为/usr/local/mysql时配置文件不需要手工调整,推荐此方式
(5)创建mysql组和用户
sudo groupadd mysql
sudo useradd -r -d /usr/local/mysql -g mysql mysql
(5)进入目标目录执行初始化
操作过程如下:
deepin:~/Downloads$ cd /usr/local/mysql deepin:/usr/local/mysql$ ls bin include LICENSE man README.router share var docs lib LICENSE.router README run support-files :/usr/local/mysql$ sudo bin/mysqld --initialize --user=mysql 2019-12-28T14:54:54.917880Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server in progress as process 6559 2019-12-28T14:55:01.954598Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: lZN/)lOz5%1e 2019-12-28T14:55:04.812510Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server has completed
注意:记下为root用户生成的初始密码,首次登陆时用到,然后修改为期望的密码
(6)启动MySQL
操作命令如下:
deepin:/usr/local/mysql$ sudo bin/mysqld_safe --user=mysql &
(7)修改root密码
操作过程如下:
deepin:/usr/local/mysql/bin$ ./mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.16 Copyright (c) 2000, 2019, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPassword@123'; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> quit Bye
上述过程只是为了修改root密码,之后需要停止MysQL(先查到进程号再kill),操作过程如下:
Deepin:/usr/local/mysql$ ps -ef|grep mysql root 14854 14190 0 14:36 pts/1 00:00:00 sudo bin/mysqld_safe --user=mysql root 14855 14854 0 14:36 pts/1 00:00:00 /bin/sh bin/mysqld_safe --user=mysql mysql 14926 14855 0 14:36 pts/1 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=Deepin.err --pid-file=Deepin.pid myuser 15063 9348 0 14:39 pts/0 00:00:00 grep mysql herov@Deepin:/usr/local/mysql$ sudo kill 14926
(8)配置MySQL为服务
在/usr/lib/systemd/system/
目录下创建配置文件mysqld.service,
sudo vi /usr/lib/systemd/system/mysqld.service
示例如下:
[Unit] Description=MySQL Server After=network.target local-fs.target remote-fs.target [Service] Type=forking PIDFile=/usr/local/mysql/data/Deepin-pc.pid ExecStart=/usr/local/mysql/support-files/mysql.server start ExecStop=/usr/local/mysql/support-files/mysql.server stop ExecReload=/usr/local/mysql/support-files/mysql.server restart User=mysql [Install] WantedBy=multi-user.target
注意:上述PIDFile的文件名Deepin-pc.pid是主机名为Deepin-pc时的进程文件名,需要为主机名+pid,主机名可通过hostname命令查看到,如果进程文件名与hostname不一致可能导致后续的Mysql服务无法启动;
之后,可通过命令行加入为自启服务:
sudo systemctl enable mysqld.service
之后,如手工启动服务,则:
sudo systemctl start mysqld.service
(9)将mysql用户设置为只使用禁登陆的方式
为了防止外部通过mysql用户访问系统,将mysql用户设置为不能登陆,例如将登陆shell设置为bin/false:
Deepin:/usr/local/mysql$ sudo usermod -s /bin/false mysql
二、设置Deepin使得shell支持ll等快捷命令
参考:https://bestsort.cn/2019/08/08/890/
编辑配置文件:
sudo vi /etc/bash.bashrc
在文件尾部追加如下内容:
alias tailf="tail -f -n" alias ls="ls --color=auto" alias ll="ls -alF"
保存上述文件后,执行:
source /etc/bash.bashrc
三、安装JDK
(1)下载Oracle JDK
参考下载链接:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
需要注意下载xxx.tar.gz的包到Deepin,例如:jdk-8u231-linux-x64.tar.gz
(2)解压安装包
tar xvf jdk-8u231-linux-x64.tar.gz
(3)移动解压后的目录到/usr/local目录
sudo mv ./jdk1.8.0_231 /usr/local/java
(4)设置环境变量
参考链接:https://blog.csdn.net/qq_41892229/article/details/81773079
编辑/etc/profile
sudo vi /etc/profile
增加如下内容:
#Add Java and Maven enviroment JAVA_HOME=/usr/local/java export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
四、安装Maven
(1)下载Maven
参考下载链接:http://maven.apache.org/download.cgi
下载相应的xxx.tar.gz包,例如:apache-maven-3.6.3-bin.tar.gz
(2)解压安装包
tar zxvf apache-maven-3.6.3-bin.tar.gz
(3)移动解压后的目录到/usr/local/maven目录
sudo mv ./apache-maven-3.6.3 /usr/local/maven
(4)设置环境变量
编辑/etc/profile
sudo vi /etc/profile
与Java环境变量合计如下内容:
#Add Java and Maven enviroment JAVA_HOME=/usr/local/java MAVEN_HOME=/usr/local/maven export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
之后执行如下命令使得配置生效:
source /etc/profile
(5)增加永久设置
将上述(4)中与JAVA、Maven环境变量有关的内容追加到/etc/bash.bashrc并执行:
source /etc/bash.bashrc
之后可通过Deepin的应用商店安装InteliJ IDEA Community版本;
五、安装Git
(1)下载并安装Git bash
执行如下命令:
sudo apt-get install git
配置用户、email:
Deepin:~$ git config --global user.name "xxxx" Deepin:~$ git config --global user.email "[email protected]"
配置公钥、私钥:
Deepin:~$ ssh-keygen -t rsa
之后输入三次回车完成创建
查看公钥,复制到git服务器中,例如:
herov@Deepin:~$ cd .ssh herov@Deepin:~/.ssh$ cat id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADA
. . .
(2)安装客户端工具,使用Deepin的应用商店安装