docker 自定义镜像的一些笔记
docker ubuntu 安装 mysql5.7
apt update
#设置时区 并安装一些必要的基本工具
apt install -y tzdata wget vim net-tools iputils-ping
cd /opt/ && mkdir mysql5.7.31 && cd mysql5.7.31
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-server_5.7.31-1ubuntu18.04_amd64.deb-bundle.tar
删除两个不需要的包
tar -vxf mysql-server_5.7.31-1ubuntu18.04_amd64.deb-bundle.tar && rm -rf mysql-community-test_5.7.31-1ubuntu18.04_amd64.deb mysql-testsuite_5.7.31-1ubuntu18.04_amd64.deb
#安装MySQL前安装一些必须的包
apt install -y libaio1 libgdbm-compat4 libgdbm6 libmecab2 libnuma1 libperl5.34 libsasl2-2 libsasl2-modules libsasl2-modules-db libtinfo5 netbase perl psmisc libmysqlclient-dev libjson-perl
dpkg -i mysql-*.deb
apt –fix-broken install
service mysql restart
* Stopping MySQL Community Server 5.7.31
* MySQL Community Server 5.7.31 is already stopped
* Re-starting MySQL Community Server 5.7.31
/etc/init.d/mysql: line 70: /lib/apparmor/profile-load: No such file or directory
..
* MySQL Community Server 5.7.31 is started
vim /etc/init.d/mysql
如果报错
/etc/init.d/mysql: line 70: /lib/apparmor/profile-load: No such file or directory
注释掉 大概在 第70行
/lib/apparmor/profile-load usr.sbin.mysqld
rm -rf /etc/mysql/conf.d/mysqld.cnf && rm -rf /etc/mysql/mysql.conf.d/mysqld.cnf
vim /etc/my.cnf
配置mysql
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
bind-address = 0.0.0.0
lower_case_table_names=1
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect=’SET NAMES utf8mb4′
max_connections = 2000
max_user_connections = 1900
max_connect_errors = 100000
max_allowed_packet = 50M
default-storage-engine=MyISAM
[mysql]
default-character-set=utf8mb4
[client]
default-character-set=utf8mb4
现在可以进入mysql
SELECT `user`,`host` FROM mysql.user;
RENAME USER ‘root’@’%’ TO ‘root’@’%’;
ALTER USER ‘root’@’loac’ IDENTIFIED WITH mysql_native_password by ‘123456’;
FLUSH PRIVILEGES;
UPDATE mysql.user SET authentication_string=password(‘123456′), host=’%’ WHERE `user`=’root’;
FLUSH PRIVILEGES;
mysql 到此结束
mysql 配置文件存储路径 /etc/my.cnf
mysql data 存储路径 /var/lib/mysql
官网地址:https://sourceforge.net/projects/sysv-rc-conf/
下载并解压安装包
wget https://sourceforge.net/projects/sysv-rc-conf/
tar zxvf sysv-rc-conf-0.98.tar.gz -C /usr/local
cd /usr/local/sysv-rc-conf-0.98
./configure
make&&make install
python 安装
apt update
apt install -y gcc build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libbz2-dev liblzma-dev sqlite3 libsqlite3-dev tk-dev uuid-dev libgdbm-compat-dev
cd /opt/
wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz && tar -xf Python-3.9.13.tgz && cd Python-3.9.13 && ./configure –enable-optimizations
make -j 2
make altinstall
python3.9 –version
mv /usr/bin/python3 /usr/local/bin/python3.9 && mv /usr/bin/python3-config /usr/local/bin/python3.9-config
ln -s /usr/local/bin/python3.9 /usr/bin/python3 && ln -s /usr/local/bin/python3.9-config /usr/bin/python3-config && ln -s /usr/local/bin/pip3.9 /usr/bin/pip3
最活跃的读者