首页
统计
留言板
直播
更多
壁纸
推荐
Git仓库
Search
1
IntelliJ IDEA激活 - 至2022年10月 (持续更新)
645 阅读
2
GitLab企业版搭建(附生成证书)
626 阅读
3
淘宝 京东秒杀脚本
422 阅读
4
Groovy模板引擎 API 构建动态脚本
324 阅读
5
欢迎使用 Typecho
294 阅读
杂货间
开发
Java
JavaScript
Android
JQuery
MySQL
PHP
Groovy
Git
运维
CentOS
Red Heat
Ubuntu
Debian
运行环境
登录
/
注册
Search
标签搜索
开发
Java
Android
MySQL8
CentOS
CentOS8
Linux
Git
Swing
JavaScript
JQuery
MySQL
临时手机号
IDEA
Steam
YouTube
订阅
激活码
GitLab
nginx
Dotdotmaples
累计撰写
30
篇文章
累计收到
7
条评论
首页
栏目
杂货间
开发
Java
JavaScript
Android
JQuery
MySQL
PHP
Groovy
Git
运维
CentOS
Red Heat
Ubuntu
Debian
运行环境
页面
统计
留言板
直播
壁纸
推荐
Git仓库
搜索到
6
篇与
运维
的结果
编译安装php8
下载php# 下载源码 wget https://www.php.net/distributions/php-8.1.5.tar.gz # 解压 tar -zxf php-8.1.5.tar.gz # 安装依赖 yum -y install libxml2 libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel sqlite-devel oniguruma-devel yum -y install gcc automake autoconf libtool make yum install gcc gcc-c++ # 编译安装 ./configure --prefix=/www/server/php/php-8.1.5 --with-config-file-path=/www/server/php/php-8.1.5 --with-config-file-scan-dir=/www/server/php/php-8.1.5/php.d --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --with-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --disable-fileinfo make && make install # 复制源码所在文件夹下的php.ini-production 或 php.ini-development cp php.ini-production /www/server/php/php-8.1.5/etc/php.ini # 进入安装目录 cd /www/server/php/php-8.1.5/etc cp php-fpm.conf.default php-fpm.conf cd /www/server/php/php-8.1.5/etc/php-fpm.d cp www.conf.default www.conf # 软连接全局命令(可有可无) ln -sf /www/server/php/php-8.1.5/sbin/* /usr/local/sbin/ ln -sf /www/server/php/php-8.1.5/bin/* /usr/local/bin/Package 'XXXX', required by 'virtual:world', not found)# Package 'libxml-2.0', required by 'virtual:world', not found这样的错误都可以执行yum search libxml2-devel如果有,就是直接安装,没有就只能下载源码安装了 yum install libxml2-devel # Package 'oniguruma', required by 'virtual:world', not found)分情况 centos8之前都可以用 yum install oniguruma-devel # centos8暂时就只能源码编译安装 # https://github.com/kkos/oniguruma/releases wget https://github.com/kkos/oniguruma/releases/download/v6.9.7.1/onig-6.9.7.1.tar.gz tar -zxf onig-6.9.7.1.tar.gz cd onig-6.9.7 autoreconf -vfi ./configure --prefix=/usr/local/oniguruma make && make install $ vim ~/.bash_profile PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH ln -s /usr/local/oniguruma/lib/pkgconfig/oniguruma.pc /usr/local/lib/pkgconfig/ ln -s /usr/local/openssl/lib64/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/ ln -s /usr/local/openssl/lib64/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/ ln -s /usr/local/openssl/lib64/pkgconfig/openssl.pc /usr/local/lib/pkgconfig/编译配置说明--prefix=/www/server/php/php-8.1.5 # 配置安装目录 --with-config-file-path=/www/server/php/php-8.1.5 # 配置文件 php.ini 的路径 --enable-sockets # 开启 socket --enable-fpm # 启用 fpm 扩展 --enable-cli # 启用 命令行模式 (从 php 4.3.0 之后这个模块默认开启所以可以不用再加此命令) --enable-mbstring # 启用 mbstring 库 --enable-pcntl # 启用 pcntl (仅 CLI / CGI) --enable-soap # 启用 soap --enable-opcache # 开启 opcache 缓存 --disable-fileinfo # 禁用 fileinfo (由于 5.3+ 之后已经不再持续维护了,但默认是开启的,所以还是禁止了吧)(1G以下内存服务器直接关了吧) --disable-rpath # 禁用在搜索路径中传递其他运行库。 --with-mysqli # 启用 mysqli 扩展 --with-pdo-mysql # 启用 pdo 扩展 --with-iconv-dir # 启用 XMLRPC-EPI 字符编码转换 扩展 --with-openssl # 启用 openssl 扩展 (需要 openssl openssl-devel) --with-fpm-user=nginx # 设定 fpm 所属的用户 --with-fpm-group=nginx # 设定 fpm 所属的组别 --with-curl # 启用 curl 扩展 --with-mhash # 开启 mhash 基于离散数学原理的不可逆向的php加密方式扩展库 # GD ----enable-gd # 启用 GD 图片操作 扩展 --with-jpeg-dir # 开启对 jpeg 图片的支持 (需要 libjpeg) --with-png-dir # 开启对 png 图片支持 (需要 libpng) --with-freetype-dir # 开启 freetype 从 PHP 7.4.0 开始使用 --with-freetype 代替,它依赖于 pkg-config。 # 压缩 从 PHP 7.4.0 开始,必须在编译 PHP 时用 --with-zip 配置选项来提供 zip 支持。之前的 PHP 版本,需要使用 --enable-zip 选项 --enable-zip # 启用 zip --with-zlib # 启用对 zlib 支持 # xml --enable-simplexml # 启用对 simplexml 支持 --with-libxml-dir # 启用对 libxml2 支持 --enable-debug # 开启 debug 模式
2022年05月07日
104 阅读
0 评论
0 点赞
编译安装Nginx
安装环境# 安装make: yum -y install gcc automake autoconf libtool make # 安装g++: yum install gcc gcc-c++安装可选库一般我们都需要先装pcre和zlib,前者为了重写rewrite,后者为了gzip压缩选定源码目录可以是任何目录,本文选定的是/usr/local/src安装PCRE库也可以选择从GitHub下载# 创建源码目录 mkdir /usr/local/src/pcre && cd /usr/local/src/pcre # 下载源码 wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz # 解压 tar -zxf pcre-8.45.tar.gz # 进入源码目录 cd pcre-8.45 # 安装 ./configure make && make install安装zlib库# 创建源码目录 mkdir /usr/local/src/zlib && cd /usr/local/src/zlib # 下载源码 wget https://zlib.net/zlib-1.2.12.tar.gz # 解压 tar -zxf zlib-1.2.12.tar.gz # 进入源码目录 cd zlib-1.2.12 # 安装 ./configure make && make install安装或更新openssl(某些vps默认没装openssl)参考安装Nginx下载nginx源码mkdir /www/server/nginx/src cd /www/server/nginx/src wget https://nginx.org/download/nginx-1.20.2.tar.gz # 解压 tar -zxf nginx-1.20.2.tar.gz # 进入源码目录 cd nginx-1.20.2 # 编译安装 ./configure --prefix=/www/server/nginx/nginx-1.20.2 --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_v2_module --with-http_gzip_static_module --with-file-aio --with-http_realip_module --with-openssl=/usr/local/src/openssl/openssl-3.0.2 --with-pcre=/usr/local/src/pcre/pcre-8.45 --with-zlib=/usr/local/src/zlib/zlib-1.2.12 make && make install创建结构# 证书 mkdir /www/server/nginx/cert # server配置 mkdir /www/server/nginx/conf mkdir /www/server/nginx/proxy_cache_dir mkdir /www/server/nginx/proxy_temp_dir mkdir /www/server/nginx/rewritehttp { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; include /www/server/nginx/conf/*.conf; }
2022年05月07日
85 阅读
0 评论
0 点赞
GitLab企业版搭建(附生成证书)
GitLab企业版搭建(附生成证书)GitLab官方文档部分内容摘自 【CSDN】万wu皆可爱安装GitLab EE安装环境 Raspberry Pi 4 8G (Rocky 8.5) root用户安装一些依赖支持# 若是没有安装完成也是没有啥子问题的(我的policycoreutils-python就没安装完成,包都没找着),不过前提是安装正常 yum install -y curl policycoreutils-python openssh-server perl检查ssh服务# 设置自启并开启ssh服务,这东西吧,我都能连服务器了,当然就是开着的,就当走个过场 systemctl enable sshd systemctl start sshd设置防火墙# 检查防火墙,查看防火墙状态可以用: systemctl status firewalld firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https systemctl reload firewalld # 当然,也可以用简单粗暴的方法 systemctl stop firewalld systemctl disable firewalld配置邮件服务器我这里推荐postfix, 当然也可以用其他的,比如SMTP等, SMTP服务可以参考官方的文档# 安装postfix yum install postfix # 设置自启 systemctl enable postfix # 启动postfix systemctl start postfix下载并安装gitlab-ee rpm软件包(2种方式)通过官方脚本安装curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash下载RPM包手动安装rpm -ivh gitlab-ee-14.0.5-ee.0.el7.x86_64.rpm安装GitLabEXTERNAL_URL ="http://gitlab.example.com" yum install -y gitlab-ee # http://gitlab.example.com为安装后访问的地址,如果是https的,那么在安装的时候会自动申请Let’s Encrypt的免费证书登陆默认用户名是root, 密码在/etc/gitlab/initial_root_password这个文件里生成证书安装2.3版本以上的rubyyum install ruby # 查看版本 ruby -v安装GitLab的证书包gem install gitlab-license创建生成证书的ruby源文件源文件参考vi license.rb # 以下为源文件内容 require "openssl" require "gitlab/license" key_pair = OpenSSL::PKey::RSA.generate(2048) File.open("license_key", "w") { |f| f.write(key_pair.to_pem) } public_key = key_pair.public_key File.open("license_key.pub", "w") { |f| f.write(public_key.to_pem) } private_key = OpenSSL::PKey::RSA.new File.read("license_key") Gitlab::License.encryption_key = private_key license = Gitlab::License.new license.licensee = { "Name" => "gitlab", "Company" => "GitLab", "Email" => "gitlab@gitlab.com", } # 开始时间 license.starts_at = Date.new(2020, 1, 1) # 结束时间 license.expires_at = Date.new(2050, 1, 1) license.notify_admins_at = Date.new(2049, 12, 1) license.notify_users_at = Date.new(2049, 12, 1) license.block_changes_at = Date.new(2050, 1, 1) license.restrictions = { active_user_count: 10000, } puts "License:" puts license data = license.export puts "Exported license:" puts data File.open("GitLabBV.gitlab-license", "w") { |f| f.write(data) } public_key = OpenSSL::PKey::RSA.new File.read("license_key.pub") Gitlab::License.encryption_key = public_key data = File.read("GitLabBV.gitlab-license") $license = Gitlab::License.import(data) puts "Imported license:" puts $license unless $license raise "The license is invalid." end if $license.restricted?(:active_user_count) # 用户数 active_user_count = 10000 if active_user_count > $license.restrictions[:active_user_count] raise "The active user count exceeds the allowed amount!" end end if $license.notify_admins? puts "The license is due to expire on #{$license.expires_at}." end if $license.notify_users? puts "The license is due to expire on #{$license.expires_at}." end module Gitlab class GitAccess def check(cmd, changes = nil) if $license.block_changes? return build_status_object(false, "License expired") end end end end puts "This instance of GitLab Enterprise Edition is licensed to:" $license.licensee.each do |key, value| puts "#{key}: #{value}" end if $license.expired? puts "The license expired on #{$license.expires_at}" elsif $license.will_expire? puts "The license will expire on #{$license.expires_at}" else puts "The license will never expire." end生成证书ruby license.rb # 执行完成后会生成如下三个文件 # GitLabBV.gitlab-license|license_key|license_key.pub # 第一个是证书,第二个是私钥,第三个是公钥使用许可证# 用license_key.pub替换/opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub # 重启GitLab gitlab-ctl -restart # 访问${address}/admin/license/new并用生成的GitLabBV.gitlab-license文件上传 #或者 ${address}/admin/license修改证书等级vi /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb # 将 # restricted_attr(:plan).presence || STARTER_PLAN # 替换成 # restricted_attr(:plan).presence || ULTIMATE_PLAN # 重新加载配置 gitlab-ctl reconfigure配置与操作相关命令启动全部服务gitlab-ctl start重启全部服务gitlab-ctl restart停止全部服务gitlab-ctl stop重启单个服务,如重启nginxgitlab-ctl restart nginx查看服务状态gitlab-ctl status使配置文件生效gitlab-ctl reconfigure验证配置文件gitlab-ctl show-config删除gitlab(保留数据)gitlab-ctl uninstall删除所有数据,从新开始gitlab-ctl cleanse查看服务的日志gitlab-ctl tail <service name> # 如查看gitlab下nginx日志 gitlab-ctl tail nginx进入控制台gitlab-rails consoleGitlab反向代理默认情况下,Omnibus GitLab 会自动检测是否使用 SSL(如果包含 NGINX 并将其配置为 SSL 终端)。但是,如果将 GitLab 配置为在反向代理或外部负载均衡器后面运行,则某些环境可能希望在 GitLab 应用程序外部终端部署 SSL。vi etc/gitlab/gitlab.rb nginx['listen_port'] = 80 nginx['listen_https'] = false external_url 'https://git.fengling.org'关闭 Gitlab 组件由于 Gitlab 核心功能是代码托管,所以有些额外的组件比较浪费资源,所以可以考虑关闭。prometheus['enable'] = false prometheus['monitor_kubernetes'] = false alertmanager['enable'] = false node_exporter['enable'] = false redis_exporter['enable'] = false postgres_exporter['enable'] = false gitlab_exporter['probe_sidekiq'] = false prometheus_monitoring['enable'] = false grafana['enable'] = false 初始化 Gitlab 组件第一次需要初始化 gitlab 服务,后续如果对 gitlab配置文件进行修改,也需要执行初始化进行重新配置。gitlab-ctl reconfigure gitlab-ctl status gitlab-ctl stop gitlab-ctl start验证 Gitlab 组件重新初始化后通过 gitlab-rails 检查 gitlab 邮箱是否可正常使用。# 打开控制台 gitlab-rails console # 发送邮件 Notify.test_email('dotdotmaples@163.com','test','gitlab').deliver_now日常维护备份修改默认存放备份站点目录,然后进行重新加载配置文件vim /etc/gitlab/gitlab.rb # 自定义备份路径 gitlab_rails['backup_path'] = "/data/gitlab/backups" # 保留7天 gitlab_rails['backup_keep_time'] = 604800 mkdir /data/gitlab/backups -p手动执行备份命令,会将备份的结果存储至/data/gitlab/backups 目录中gitlab-rake gitlab:backup:create # 也可以将备份命令写入定时任务每天进行自动备份 crontab -l 00 03 * * * /usr/bin/gitlab-rake gitlab:backup:create数据恢复当误删除项目,或者误删除用户等数据时候,如果之前有备份,那么可以做恢复操作。停止数据写入服务gitlab-ctl stop unicorn gitlab-ctl stop sidekiq通过 gitlab-rake 命令进行恢复,恢复时需要指定此前备份的名称。(但不需要写名称的.tar后缀)gitlab-rake gitlab:backup:restore BACKUP=1634715076_2021_10_20_12.3.0重启gitlab,检测是否 gitlab 是否恢复。gitlab-ctl restart迁移升级一般情况,gitlab一经使用,则不会升级;除非做迁移,例如从本地环境迁移到阿里云时,可以顺便升级;一般情况下,迁移会迁移两个文件,/etc/gitlab/gitlab.rb 和backups下的备份文件。在新节点需要安装相同的版本,先恢复数据数据恢复后先升级到本版本的最后一个版本,然后再升级到下个版本,例如(12.3 —> 12.9.9 --> 13),不能跨版本升级。如果从12 最后一个版本升级到13 ,会报错yum localinstall gitlabce-13.0.10-ce.0.el7.x86_64.rpm -y #会提示报错: Running transaction * gitlab_monitor['enable'] has been deprecated since 12.3 and was removed in 13.0. Use gitlab_exporter['enable'] instead.只需要根据提示编辑 /etc/gitlab.rb 配置文件#提示什么错变更什么即可 gitlab_monitor['enable'] =false gitlab_exporter['enable'] = false修改配置后重新初始化,然后在进行升级gitlab-ctl reconfigure yum localinstall gitlabce-13.0.10-ce.0.el7.x86_64.rpm -y安全将访问网页的 HTTP 协议升级到 HTTPS协议,保证数据安全;阿里云上申请下载nginx证书到/ssh_key文件夹mkdir -p /ssl_key修改 Gitlab 配置文件vim /etc/gitlab/gitlab.rb external_url "https://gitlab.bertwu.online" # 必须修改 nginx['enable'] = true nginx['client_max_body_size'] = '1000m' nginx['redirect_http_to_https'] = true nginx['redirect_http_to_https_port'] = 80 # 所有请求80的都跳转到443 nginx['ssl_certificate'] = "/ssl_key/server.crt" nginx['ssl_certificate_key'] = "/ssl_key/server.key" nginx['ssl_ciphers'] = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256" nginx['ssl_prefer_server_ciphers'] = "on" nginx['ssl_protocols'] = "TLSv1.2" nginx['ssl_session_cache'] = "builtin:1000 nnshared:SSL:10m" nginx['ssl_session_timeout'] = "1440m"重新初始化 Gitlabgitlab-ctl reconfigure忘记密码如何重置 GitLab的 root 密码 官方修改密码方式在 root 用户下,执行gitlab-rails console -e production -------------------------------------------------------------------------------- GitLab: 12.3.0 (4fcd588b89f) GitLab Shell: 10.0.0 PostgreSQL: 10.9 --------------------------------------------------------------------------------获得用户数据,修改用户密码irb(main):001:0> user=User.where(id:1).first => #<User id:1 @root> #更改密码并确认密码 irb(main):002:0> user.password="12345678" => "12345678" irb(main):003:0> user.password_confirmation="12345678" => "12345678" #保存退出 irb(main):004:0> user.save! Enqueued ActionMailer::DeliveryJob (Job ID: 07420155-1ccb-44a5-9b1c-c74e0253f253) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f6ee7794b38 @uri=#<URI::GID gid://gitlab/User/1>> => true irb(main):005:0> quit
2021年07月12日
626 阅读
0 评论
11 点赞
Linux操作
文件服务器间传输文件rsync需要安装, 但是能设置过滤文件夹# 安装 yum -y install rsync # 使用示例 rsync -ravP -e 'ssh -p 2222' user@remote-server:/path/to/remote/folder /path/to/local/folder # -v:显示rsync过程中详细信息。可以使用"-vvvv"获取更详细信息。 # -P:显示文件传输的进度信息。(实际上"-P"="--partial --progress",其中的"--progress"才是显示进度信息的)。 # -n --dry-run :仅测试传输,而不实际传输。常和"-vvvv"配合使用来查看rsync是如何工作的。 # -a --archive :归档模式,表示递归传输并保持文件属性。等同于"-rtopgDl"。 # -r --recursive:递归到目录中去。 # -t --times:保持mtime属性。强烈建议任何时候都加上"-t",否则目标文件mtime会设置为系统时间,导致下次更新检查出mtime不同从而导致增量传输无效。 # -o --owner:保持owner属性(属主)。 # -g --group:保持group属性(属组)。 # -p --perms:保持perms属性(权限,不包括特殊权限)。 # -D :是"--device --specials"选项的组合,即也拷贝设备文件和特殊文件。 # -l --links:如果文件是软链接文件,则拷贝软链接本身而非软链接所指向的对象。 # -z :传输时进行压缩提高效率。 # -R --relative:使用相对路径。意味着将命令行中指定的全路径而非路径最尾部的文件名发送给服务端,包括它们的属性。用法见下文示例。 # --size-only :默认算法是检查文件大小和mtime不同的文件,使用此选项将只检查文件大小。 # -u --update :仅在源mtime比目标已存在文件的mtime新时才拷贝。注意,该选项是接收端判断的,不会影响删除行为。 # -d --dirs :以不递归的方式拷贝目录本身。默认递归时,如果源为"dir1/file1",则不会拷贝dir1目录,使用该选项将拷贝dir1但不拷贝file1。 # --max-size :限制rsync传输的最大文件大小。可以使用单位后缀,还可以是一个小数值(例如:"--max-size=1.5m") # --min-size :限制rsync传输的最小文件大小。这可以用于禁止传输小文件或那些垃圾文件。 # --exclude :指定排除规则来排除不需要传输的文件。 # --delete :以SRC为主,对DEST进行同步。多则删之,少则补之。注意"--delete"是在接收端执行的,所以它是在exclude/include规则生效之后才执行的。 # -b --backup :对目标上已存在的文件做一个备份,备份的文件名后默认使用"~"做后缀。 # --backup-dir:指定备份文件的保存路径。不指定时默认和待备份文件保存在同一目录下。 # -e :指定所要使用的远程shell程序,默认为ssh。 # --port :连接daemon时使用的端口号,默认为873端口。 # --password-file:daemon模式时的密码文件,可以从中读取密码实现非交互式。注意,这不是远程shell认证的密码,而是rsync模块认证的密码。 # -W --whole-file:rsync将不再使用增量传输,而是全量传输。在网络带宽高于磁盘带宽时,该选项比增量传输更高效。 # --existing :要求只更新目标端已存在的文件,目标端还不存在的文件不传输。注意,使用相对路径时如果上层目录不存在也不会传输。 # --ignore-existing:要求只更新目标端不存在的文件。和"--existing"结合使用有特殊功能,见下文示例。 # --remove-source-files:要求删除源端已经成功传输的文件。scp不需要安装, 但是不能过滤文件夹或文件# 本地传输到远程服务器 scp local_file remote_username@remote_ip:remote_folder # 或者 scp local_file remote_username@remote_ip:remote_file # 或者 scp local_file remote_ip:remote_folder # 或者 scp local_file remote_ip:remote_file # 远程服务器传输到本地 scp remote_username@remote_ip:remote_folder local_file # 或者 scp remote_username@remote_ip:remote_file local_file # 或者 scp remote_ip:remote_folder local_file # 或者 scp remote_ip:remote_file local_file # -1: 强制scp命令使用协议ssh1 # -2: 强制scp命令使用协议ssh2 # -4: 强制scp命令只使用IPv4寻址 # -6: 强制scp命令只使用IPv6寻址 # -B: 使用批处理模式(传输过程中不询问传输口令或短语) # -C: 允许压缩。(将-C标志传递给ssh,从而打开压缩功能) # -p:保留原文件的修改时间,访问时间和访问权限。 # -q: 不显示传输进度条。 # -r: 递归复制整个目录。 # -v:详细方式显示输出。scp和ssh(1)会显示出整个过程的调试信息。这些信息用于调试连接,验证和配置问题。 # -c cipher: 以cipher将数据传输进行加密,这个选项将直接传递给ssh。 # -F ssh_config: 指定一个替代的ssh配置文件,此参数直接传递给ssh。 # -i identity_file: 从指定文件中读取传输时使用的密钥文件,此参数直接传递给ssh。 # -l limit: 限定用户所能使用的带宽,以Kbit/s为单位。 # -o ssh_option: 如果习惯于使用ssh_config(5)中的参数传递方式, # -P port:注意是大写的P, port是指定数据传输用到的端口号 # -S program: 指定加密传输时所使用的程序。此程序必须能够理解ssh(1)的选项。SSH密钥密钥生成ssh-keygen创建一个 SSH key# 创建一个SSH登陆密钥, 一直回车可以生成一个无密码登陆的密钥 ssh-keygen -t dsa # -t 指定密钥类型,默认是 rsa ,可以省略。 # -C 设置注释文字,比如邮箱。 # -f 指定密钥文件存储文件名。密钥传递ssh-copy-id将密钥复制到远程电脑实现无密码登陆# 从/root/.ssh下复制密钥到远程电脑 ssh-copy-id root@192.168.xxx.xxx # 复制指定密钥文件到远程电脑 ssh-copy-id -i /xxx/xxx/xxx.pub root@192.168.xxx.xxx
2021年01月12日
124 阅读
0 评论
0 点赞
CentOS8 使用 aliyun 阿里云 镜像站点的方法
备份repo文件# 用cd命令切换到yum.repos目录,备份原始的3个repo文件: cd /etc/yum.repos.d/ cp CentOS-AppStream.repo CentOS-AppStream.repo.bak cp CentOS-Base.repo CentOS-Base.repo.bak cp CentOS-Extras.repo CentOS-Extras.repo.bak编辑上面3个repo文件,在mirrorlist前加个#,并把baseurl前的#去掉。baseurl里的 mirror.centos.org/$contentdir 修改为 mirrors.aliyun.com/centos 即可。修改文件# 以CentOS-AppStream.repo为例,其他两个文件同理。 vim CentOS-AppStream.repo修改前: mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ 修改后: #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/注意:如果使用的是CentOS8 Stream版本,还需要修改 CentOS-Stream-开头的3个repo文件。修改完成后运行 yum update 正常更新。补充:epel-release的源可同理修改:yum -y install epel-release vim /etc/yum.repos.d/epel.repo
2019年12月04日
198 阅读
0 评论
0 点赞
CentOS8在线安装MySQL8
清理环境1.检查是否安装了MySQLrpm -qa | grep mysql ## 卸载已经安装的MySQL yum remove mysql-xxx-xxx ## 检查并删除MySQL的配置文件 find / -name mysql rm -rf xxxxxxxxxx2. 删除MariaDB的文件rpm -pa | grep mariadb ## 可能出现 mariadb-libs-5.5.56-2.el7.x86_64 yum -y remove mariadb-libs.x86_64安装MySQL1.下载 MySQL源前往官方网站复制yum源链接,CentOS8是属于Red Hat再编译版本,所以选择Red Hat Enterprise Linux 8 / Oracle Linux 8 (Architecture Independent), RPM Package 点击Download按钮进入如下界面## 鼠标放在这个 No thanks, just start my download.上 鼠标右键 --> 复制链接地址(wget + 复制的链接地址进行下载) wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm ## 安装MySQL源 rpm -ivh mysql80-community-release-el8-1.noarch.rpm ## 卸载使用 rpm -Uvh mysql80-community-release-el8-1.noarch2.安装yum -y install mysql-server ## 注意:这里的MySQL8不是mysql-community-server ## 启动MySQL systemctl start mysqld ## 重启MySQL systemctl restart mysqld ## 停止MySQL systemctl stop mysqld 默认配置文件路径: 配置文件:/etc/my.cnf 日志文件:/var/log/var/log/mysqld.log 服务启动脚本:/usr/lib/systemd/system/mysqld.service socket文件:/var/run/mysqld/mysqld.pid登陆并配置MySQL1.登陆mysql -u root ## 第一次登陆没有密码,如果需要密码可以使用下面的命令查询初始密码 cat /var/log/mysqld.log | grep password2.配置-- 设置Root密码 alter user 'root'@'localhost' identified by 'mysql123456'; -- 切换到MySQL库 use mysql; -- 设置登陆权限 update user set Host = '%' where User = 'root'; -- 要想设置简单密码要先修改安全等级 MySQL8的修改命令如下 -- 用于控制validate_password的验证策略 0 --> low 1 --> MEDIUM 2 --> strong set global validate_password.policy = 0; -- 密码长度的最小值 set global validate_password.length = 1; -- 大小写的最小个数 set global validate_password.mixed_case_count = 2; -- 总之8的密码策略就是将validate_password后的‘_’变成‘.’
2019年11月07日
46 阅读
0 评论
0 点赞