分类目录归档:LINUX

yum update异常中断问题

1、由于网络不好,导致yum命令中断,再次执行时提示
Another app is currently holding the yum lock; waiting for it to exit…

2、解决办法
rm -f /var/run/yum.pid
yum install yum-utils
yum clean all
yum-complete-transaction --cleanup-only
yum history redo last

3、安装yum-utils包时提示
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
The program yum-complete-transaction is found in the yum-utils package.

以后yum-utils包要事先安装好

4、RPM数据库错误问题
事务处理完后,执行yum update还是报错:
--> 解决依赖关系完成
错误:软件包:7:device-mapper-libs-1.02.164-7.el7_8.1.x86_64 (@updates)
需要:device-mapper = 7:1.02.164-7.el7_8.1
正在删除: 7:device-mapper-1.02.164-7.el7_8.1.x86_64 (@updates)
device-mapper = 7:1.02.164-7.el7_8.1
更新,由: 7:device-mapper-1.02.164-7.el7_8.2.x86_64 (updates)
device-mapper = 7:1.02.164-7.el7_8.2
可用: 7:device-mapper-1.02.164-7.el7.x86_64 (base)
device-mapper = 7:1.02.164-7.el7
您可以尝试添加 --skip-broken 选项来解决该问题
** 发现 6 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
7:device-mapper-libs-1.02.164-7.el7_8.2.x86_64 是 7:device-mapper-libs-1.02.164-7.el7_8.1.x86_64 的副本
7:device-mapper-libs-1.02.164-7.el7_8.2.x86_64 有缺少的需求 device-mapper = ('7', '1.02.164', '7.el7_8.2')
mesa-khr-devel-18.3.4-7.el7_8.1.x86_64 是 mesa-khr-devel-18.3.4-7.el7.x86_64 的副本
mesa-libglapi-18.3.4-7.el7_8.1.x86_64 是 mesa-libglapi-18.3.4-7.el7.x86_64 的副本
systemd-219-73.el7_8.6.x86_64 是 systemd-219-73.el7_8.5.x86_64 的副本
systemd-libs-219-73.el7_8.6.x86_64 是 systemd-libs-219-73.el7_8.5.x86_64 的副本
Warning: Some duplicates were not removed because they are required by installed packages.
You can try --cleandupes with --removenewestdupes, or review them with --dupes and remove manually.

现象是本机rpm数据库里记录了某个rpm包多个版本(可能事实上只装了一个版本)

查看软件包信息,发现存在多条信息:
rpm -qa | grep systemd
systemd-libs-219-73.el7_8.6.x86_64
systemd-219-73.el7_8.6.x86_64
systemd-libs-219-73.el7_8.5.x86_64
systemd-219-73.el7_8.5.x86_64
systemd-sysv-219-73.el7_8.5.x86_64

多了两条重复的:
systemd-libs-219-73.el7_8.5.x86_64
systemd-219-73.el7_8.5.x86_64

先解决xxx是xxx的副本:
rpm -e --noscripts device-mapper-libs-1.02.164-7.el7_8.2.x86_64
rpm -e --noscripts mesa-khr-devel-18.3.4-7.el7_8.1.x86_64
rpm -e --noscripts mesa-libglapi-18.3.4-7.el7_8.1.x86_64
rpm -e --noscripts systemd-219-73.el7_8.6.x86_64
rpm -e --noscripts systemd-libs-219-73.el7_8.6.x86_64

清理冲突:
package-cleanup --cleandupes

重新执行yum update,解决

Docker学习(6)—容器中wordpress更新时提示登陆ftp

原因为nginx对目录没有写文件权限,代码是存在宿主机的,文件夹权限为root用户

1、登陆nginx容器环境
docker exec -it nginx /bin/bash

2、查看目录/var/www/html都是root用户权限
ls -al /var/www/html

3、查看容器用户
cat /etc/passwd
发现:
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
而nginx一般是用www-data用户来运行,它的家目录就是/var/www

4、将/var/www下改为www-data用户
cd /var/www
chown -R www-data:www-data ./

5、再次尝试,可以更新了

6、查看宿主机目录权限有没有变
ls -al /appserver/code/
drwxr-xr-x 8 33 33 4096 4月 12 08:19 wordpress

也变成了uid为33,因为是目录映射到容器中。容器中的改动也反映在宿主机上

centos安装gitlab-ce

1、gitlab是什么
gitlab是git仓库的管理工具,提供web页面方便用户使用。
gitlab-ce和gitlab-ee,ce是社区版,ee是企业版,企业版有些功能需要付费使用。

2、从官方仓库上安装gitlab
添加官方仓库:
curl -L https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

3、安装postfix
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

4、安装gitlab
yum install gitlab-ce

5、安装完成后会有提示信息
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

GitLab now ships with a newer version of PostgreSQL (11.7), but it is not yet
enabled by default. To upgrade, please see:
https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server

6、编辑/etc/gitlab/gitlab.rb
将:
# nginx['listen_port'] = nil
修改为:
nginx['listen_port'] = 8888
将:
external_url 'http://gitlab.example.com'
修改为:
external_url 'http://你的IP地址:8888'
注:这里external_url需要加上端口,否则使用http克隆和查看文件,链接里会没有端口

继续阅读centos安装gitlab-ce

Docker学习(5)—docker中安装php扩展模块gd、exif

1、进入容器
docker exec -it php /bin/bash

2、查看php当前模块
php -m

3、安装依赖包
apt-get install libwebp-dev libjpeg-dev libpng-dev zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev

4、添加GD库编译选项
docker-php-ext-configure gd --with-jpeg-dir=/usr/include/

5、安装gd、exif模块
docker-php-ext-install gd

6、安装exif模块
docker-php-ext-install exif

7、重启容器
exit
docker restart php
docker restart nginx

8、查看phpinfo
出现gd模块,并且有:
JPEG Support:enabled
libJPEG Version:6b

参考资料:
https://www.azimiao.com/4903.html

CentOS安装node.js环境(以编译ariaNg为例)

1、安装依赖工具
yum install git

2、下载软件包
mkdir -p /appserver/software
cd /appserver/software
wget https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz
mkdir -p /usr/local/lib/nodejs
tar -xJvf node-v12.14.1-linux-x64.tar.xz -C /usr/local/lib/nodejs

3、编辑/etc/profile
vi /etc/profile
# Nodejs
VERSION=v12.14.1
DISTRO=linux-x64
export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH

4、使设置生效
source /etc/profile

5、查看版本
node -v
npm version
npx -v

继续阅读CentOS安装node.js环境(以编译ariaNg为例)

CentOS vps安装aria2 + ariaNg + h5ai搭建下载服务器

系统为CentOS7,搭建下载服务器,所用到的软件为
aria2:Linux下全功能下载工具
ariaNg:一款Aria2的WebUI工具
h5ai:一款功能强大php文件目录列表程序

一、安装aria2
1、安装
yum install epel-release zip unzip
yum install aria2

2、查看版本
aria2c -v

二、安装ariaNg(需要搭建好php环境)
1、AriaNg现在提供三种版本, 标准版、单文件版和AriaNg Native。标准版适合在Web服务器中部署, 提供资源缓存和按需加载的功能。单文件版适合本地使用, 您下载后只要在浏览器中打开唯一的html文件即可。AriaNg Native同样适合本地使用, 并且不需要使用浏览器
下载地址:https://github.com/mayswind/AriaNg/releases
这里安装标准版
2、下载ariaNg
mkdir -p /appserver/ariaNg
cd /appserver/ariaNg
wget https://github.com/mayswind/AriaNg/releases/download/1.1.4/AriaNg-1.1.4.zip
unzip AriaNg-1.1.4.zip

3、将ariaNg目录移动到web服务器根目录
mv /appserver/ariaNg /var/www/html
4、浏览器访问
http://IP/ariaNg

继续阅读CentOS vps安装aria2 + ariaNg + h5ai搭建下载服务器

Docker学习(4)—inspect命令

docker inspect用于查看镜像的元数据,我们可以从中获取镜像挂载的卷和工作目录,返回的是一个json字符串

格式:
docker inspect --help

Usage:	docker inspect [OPTIONS] NAME|ID [NAME|ID...]

Return low-level information on Docker objects

Options:
  -f, --format string   Format the output using the given Go template
  -s, --size            Display total file sizes if the type is container
      --type string     Return JSON for specified type
继续阅读Docker学习(4)—inspect命令

Docker学习(3)—搭建PHP环境(安装wordpress为例)

1、需要一个php容器,一个mysql容器,一个nginx容器
下载nginx、php:7.2-fpm、mysql镜像:
docker pull nginx
docker pull php:7.2-fpm
docker pull mysql

注:docker官方提供的php镜像是没有fpm的

2、建立相应目录
mkdir -p /appserver/code
mkdir -p /appserver/mysql
mkdir -p /appserver/nginx
mkdir -p /appserver/logs
cd /tmp
wget https://cn.wordpress.org/latest-zh_CN.tar.gz
tar -zxvf latest-zh_CN.tar.gz -C /appserver/code/
chown root:root -R /appserver/code/

3、启动mysql容器
docker run -itd -v /appserver/mysql:/var/lib/mysql -p 33066:3306 --name=mysql -e MYSQL_ROOT_PASSWORD=123456 mysql

4、创建数据库
docker exec -it mysql /bin/bash
mysql -u root -p
create database wordpress;
create user 'wp'@'%' identified by '123456';
grant all on wordpress.* to 'wp'@'%';
alter user 'wp'@'%' identified with mysql_native_password by '123456'; (mysql8远程连接需要将加密方式从caching_sha2_password改为mysql_native_password)
flush privileges;

继续阅读Docker学习(3)—搭建PHP环境(安装wordpress为例)