centos零碎
#在一台可以联网的机器上执行下列命令准备离线安装包,机器最好内核版本一致
mkdir -p /usr/local/src/gcc
yum install --downloadonly --downloaddir=/usr/local/src/gcc gcc
#拷贝下载好的离线安装包到无网络的机器后执行下列命令
rpm -Uvh *.rpm --nodeps --force
#确认是否安装成功
gcc -v
yum install gcc gcc-c++ autoconf automake make zlib-devel pcre pcre-devel openssl-devel openssl --downloadonly --downloaddir=/data/devtools
yum install gcc gcc-c++ cmake ncurses ncurses-devel bison --downloadonly --downloaddir=/data/devtools
yum groupinstall "Development Tools" --downloadonly --downloaddir=/data/devtools
yum --enablerepo=epel install bzip2-devel curl-devel libjpeg-turbo-devel libpng-devel libicu-devel libmcrypt-devel libxml2-devel freetype-devel --downloadonly --downloaddir=/data/devtools
yum install libxslt-devel* --downloadonly --downloaddir=/data/devtools
yum install openssl openssl-devel --downloadonly --downloaddir=/data/devtools
./mysqld --initialize-insecure --user=mysql --basedir=/data/program/mysql --datadir=/data/mysqldata
./mysqld --defaults-file=/data/program/mysql/etc/my.cnf --initialize-insecure --user=mysql
cmake \
-DCMAKE_INSTALL_PREFIX=/data/program/mysql \
-DMYSQL_DATADIR=/data/mysqldata \
-DDEFAULT_CHARSET=utf8 \
-DEXTRA_CHARSETS=all \
-DSYSCONFDIR=/data/program/mysql/etc \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/data/tmp/mysql/mysql.sock \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_USER=mysql \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_BOOST=/data/mysql-5.7.35/boost/boost_1_59_0
cmake 参数解释:
-DCMAKE_INSTALL_PREFIX: 指定安装路径
-DMYSQL_DATADIR : 指定数据存放路径
-DMYSQL_UNIX_ADDR :指定套间字路径
-DDEFAULT_CHARSET : 设置字符集
-DDEFAULT_COLLATION : 设置字符校验集
-DWITH_BOOST : 指定Boost扩展源码路径
make && make install
yum -y install telnet-server.x86_64
yum -y install telnet.x86_64
yum -y install xinetd.x86_64
yum install --downloadonly --downloaddir=/data/telnet telnet-server.x86_64 telnet.x86_64 xinetd.x86_64
yum install --downloadonly --downloaddir=/data/vsftpd vsftpd
yum install --downloadonly --downloaddir=/data/nginx nginx
yum install --downloadonly --downloaddir=/data/rsync rsync
yum install --downloadonly --downloaddir=/data/download/libaio libaio
yum install --downloadonly --downloaddir=/data/download/perl perl
yum install --downloadonly --downloaddir=/data/download/libnuma libnuma*
yum -y install yum-utils
yumdownloader --resolve --destdir=/data/download/libnuma libnuma*
rpm -Uvh *.rpm --nodeps --force
useradd ftpd -s /sbin/nologin
useradd virtual -s /sbin/nologin
查看用户:cut -d : -f 1 /etc/passwd
查看用户组:cut -d : -f 1 /etc/group
删除xiaoluo这个用户:userdel -r xiaoluo
FTP
rpm -i –prefix=/home/gpadmin greenplum-db-6.0.0-rhel6-x86_64.rpm
rpm -qa | grep xxx
其他查询指令
rpm -qa 查询所有安装的rpm软件包
rpm -qa | more (分页显示)
rpm -q xxx。也可以查询软件包
rpm -qi xxx 可以显示软件包的信息
rpm -ql xxx 软件包到底装了哪些文件,安装目录分别在哪边
rpm -qf xxx
rpm -qf /etc/passwd (可以查询这个文件是哪个软件包的)
rpm -e xxx 删除某个软件包
细节问题:
rpm -e --nodeps (强制删除)
rpm -ivh xxx (安装软件包)
rpm -ivh xxx --nodeps -f (不要依赖包,强制安装)
经查找,可以使用下面的命令查看rpm包是否可以重定位,也就是安装到另一个目录。
# rpm -qpi linuxqq-v1.0.2-beta1.i386.rpm |head
Name : linuxqq Relocations: (not relocatable)
Version : v1.0.2 Vendor: Tencent Inc.
Release : beta1 Build Date: 2009年01月05日 星期一 17时31分44秒
Install Date: (not installed) Build Host: localhost.localdomain
Group : Internet Source RPM: linuxqq-v1.0.2-beta1.src.rpm
Size : 6346491 License: Commercial
Signature : (none)
Packager : @Home
Summary : QQ for Linux v1.0.2 Beta1
Description :
从结果看到
Relocations: (not relocatable)
yum install --downloadonly --downloaddir=/data/ftp ftp
# 更改目录用户所属组
chown -R sirxy:sirxy /home/sirxy/test1
# 更改目录权限(递归)
chmod -R 755 /home/sirxy/test2
yum install --downloadonly --downloaddir=/data/inotify inotify-tools
yum install --downloadonly --downloaddir=/data/jdk java-1.8.0-openjdk.x86_64
rpm -Uvh *.rpm --nodeps --force
netstat -antup
yum install --downloadonly --downloaddir=/data/redis redis
rpm -e postgresql96-9.6.24-1PGDG.rhel6.x86_64
rpm -e postgresql96-libs-9.6.24-1PGDG.rhel6.x86_64
rpm -e postgresql96-server-9.6.24-1PGDG.rhel6.x86_64
rpm -e postgresql96-contrib-9.6.24-1PGDG.rhel6.x86_64
yum install --downloadonly --downloaddir=/data/download/readline readline*
rpm -ivh readline-devel-6.0-4.el6.x86_64.rpm
rpm -ivh --prefix=/opt/PostgreSQL/9.6
./configure --prefix=/opt/PostgreSQL/9.6
临时修改(当前终端生效):
export LANG="zh_CN.UTF-8"
永久修改:
echo "export LANG=zh_CN.UTF-8" >> /etc/profile
source /etc/profile
/opt/PostgreSQL/9.6/bin/initdb --encoding=UTF8 --lc-collate=zh_CN.utf8 --lc-ctype=zh_CN.utf8 --lc-messages=zh_CN.utf8 --lc-monetary=zh_CN.utf8 --lc-numeric=zh_CN.utf8 --lc-time=zh_CN.utf8 -D /opt/PostgreSQL/9.6/data
/opt/PostgreSQL/9.3/bin/initdb --username=root --encoding=UTF8 --lc-collate=C --lc-ctype=en_US.utf8 --data-checksums -D /var/lib/pgsql/12/data
service postgresql-9.6 stop
su - postgres
cd /tmp
/opt/PostgreSQL/9.6/bin/pg_upgrade -d /opt/PostgreSQL/9.0/data -D /opt/PostgreSQL/9.6/data -b /opt/PostgreSQL/9.0/bin -B /opt/PostgreSQL/9.6/bin -k -c
[root ~]# lsattr /etc/passwd
[root ~]# chattr +i /etc/passwd
usermod -d /opt/PostgreSQL/9.6 -u 500 postgres
-bash-4.1$ /opt/PostgreSQL/9.6/bin/pg_ctl -D /opt/PostgreSQL/9.6/data start
UPDATE pg_database SET datcollate='en_US.UTF-8', datctype='en_US.UTF-8' WHERE datname='postgres';
/data/programs/PostgreSQL/9.0/bin/initdb --pgdata /data/programs/PostgreSQL/9.0/data --encoding=UTF8 --lc-collate=zh_CN.utf8 --lc-ctype=zh_CN.utf8 --lc-messages=zh_CN.utf8 --lc-monetary=zh_CN.utf8 --lc-numeric=zh_CN.utf8 --lc-time=zh_CN.utf8
initializing pg_authid ... FATAL: wrong number of index expressions STATEMENT: REVOKE ALL on pg_authid FROM public;
--pgdata /data/programs/PostgreSQL/9.0/data start