跳到主要內容

發表文章

目前顯示的是有「CentOS」標籤的文章

解決 CentOS 8.x Module yaml error: Unexpected key in data: static_context [line 9 col 3] No match for argument: install 的問題

當使用 dnf 安裝的時候, 遇到如下的錯誤: Updating Subscription Management repositories. Unable to read consumer identity This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Last metadata expiration check: 0:17:10 ago on Tue 29 Nov 2022 10:45:57 AM +08. Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Module yaml error: Unexpected key in data: static_context [line 9 col 3] Package libmodulemd-2.9.4-2.el8.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete! 這是由於 libmod...

解決CentOS 8 的 failed to set locale defaulting to c.utf-8 的問題

這原因是沒有安裝好支援的語言與字型, 特別是UTF8 並沒有被安裝到 因此使用以下指令確認 localedef -i en_US -f UTF-8 en_US.UTF-8 假如出現 "[error] character map file `UTF-8' not found: No such file or directory" 或者 [error] default character map file 'ANSI_X3.4-1968' not found : No such file or directory 那就安裝UTF8 吧 yum whatprovides "*/UTF-8.gz" 如果找到的話 "UTF-8.gz" 的話 yum install "*/UTF-8.gz" -y 再執行一次: localedef -i en_US -f UTF-8 en_US.UTF-8

解決CentOS 8 的conflicting requests – nothing provides module(perl:5.26) needed by module perl-DBD-SQLite 的問題

Problem 1: conflicting requests – nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64 Problem 2: conflicting requests – nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64 如果出現以上的錯誤訊息, 只要使用以下指令即可 yum module enable perl:5.26

動手解決CentOS 的問題 - error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery

想要在舊主機的PHP 5.4 安裝新的套件, 結果出現以下的問題 error: rpmdb: BDB0113 Thread/process 11283/139789426345792 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 -  (-30973) error: cannot open Packages database in /var/lib/rpm 原因不外乎是RPM 資料庫掛掉了... 解決辦法如下: mkdir /var/lib/rpm/backup cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/ rm -f /var/lib/rpm/__db.[0-9][0-9]* rpm --quiet -qa rpm --rebuilddb yum clean all

關於有些網站, 雖然擁有相同的SSL 設定, 可是有的 SSL 測試達到 A+ 有些則是 A 的原因

經過測試, 發現那是因為有些網站使用 wildcard (比如:  *.abc.com) 型的 SSL cert 那些能夠得到 A+ 的網站則是使用單一 (但是有 附屬的子域名 在同一張 SSL cert 裡) 型的 SSL cert  (比如:  sub.abc.com, alternative names :  sub.abc.com sub2.abc.com sub3.abc.com sub4.abc.com) 從網路上搜尋得知 "Wildcard certificates can impact security negatively if they're used by different teams and on unrelated sites, but for us it's not possible to determine if that's the case. For that reason, they're not impacting the score." 解決辦法:  暫時無解, 或者放棄使用wildcard 型的 SSL cert

在NGINX 安裝與設定 TLS 1.3 以及所面對的無法運行 TLS 1.3 的問題解決辦法

這是因為我在每個virtualhost 都有設定SSL 相關設定 (根據每個virtualhost有不同的設定)... 因此這很重要, 所有的virtual hosts (包含 /etc/nginx/conf.d) 裡, 都必須設定  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 ; 只要有一個virtualhost 不是 TLS v1.3, 所有的virtualhost 都會受影響, 降級成只有運行 TLS v1.2 (假如你之前是設定 TLS v1.2) 我不曉得這是不是NGINX的問題, 但, 顯然的, 我將所有的virtualhost 增加 TLS v1.3 之後, 所有的問題都解決了.  為此, 我花費了好幾天的時間不斷編譯安裝與測試, 特此記錄下來. 測試是否有跑 TLS v1.3, 可以使用以下的指令: openssl s_client -tls1_3 test.localhost:443 成功運行 TLS v1.3 的話, 就會顯示類似以下的資訊: 想要使用 TLS 1.3, 必須安裝 OpenSSL v1.1.1 開始的版本, 以及最低 NGINX v1.13 安裝步驟如下: yum group install "Development Tools" -y yum install gcc gcc-c++ gcc++ cmake pcre-devel -y mkdir -p /usr/local/src/nginx/modules/ cd /usr/local/src/nginx/modules/ rm -rf * git clone https://github.com/openresty/headers-more-nginx-module.git git clone https://github.com/google/ngx_brotli.git #可以選擇不安裝 git clone https://github.com/simplresty/ngx_devel_kit.git git clone https://github.com/openresty/lua-nginx-module.git cd /...

解決Linux kernel 4.13 時, VMWare Workstation Pro 12.5.7 造成的 Physical memory not enough 問題

即使電腦 / 伺服器的記憶體還有非常足夠的空間 (比如還剩下50G), 但是仍然顯示Physical memory not enough 的錯誤訊息, 造成VM Host 無法啟動 這原因是因為Workstation 的bugs, 與4.13 或以上的不太相容, 並且也無法與3.10 或者更低的相容, 因而造成不少的困擾. 解決的辦法如下: cd /usr/lib/vmware/modules/source/ tar xvf vmmon.tar cd vmmon-only/ cd linux rm -rf hostif.c wget https://raw.githubusercontent.com/mkubecek/vmware-host-modules/b50848c985f1a6c0a341187346d77f0119d0a835/vmmon-only/linux/hostif.c cd .. cd .. mv vmmon.tar vmmon.orig.tar tar cf vmmon.tar ./vmmon-only vmware-modconfig --console --install-all 然後再重新啟動Workstation Pro 以及Hosts 看看 來源參考: https://communities.vmware.com/thread/571740 https://github.com/mkubecek/vmware-host-modules/commit/b50848c985f1

解決 CentOS 7 出現的問題 ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1502979524

SSH 登入之後出現這個錯誤訊息  ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1502979524 查明原因之後發現是 __init__.py:50:info:RuntimeError: Policy not loaded 用附上的指令 ( /usr/bin/python -Es /usr/sbin/setroubleshootd -f '' ) , 出現以下問題: centos ValueError: Failed to read //etc/selinux/targeted/policy/policy.30 policy file 最直接的解決方法 : yum update selinux-policy-targeted -y 或者 yum upgrade -y

在CentOS 6.x 安裝Python 2.7 的方法

CentOS 6.x 是使用各種python 2.6 來運作, 比如yum 就是使用python 2.6, 倘若貿然升級到 2.7, 將會造成無法使用yum 的情況. 因為不可以覆蓋Python 2.6, 所以採用以下的方法: wget http://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz tar -zxvf Python-2.7.12.tgz cd Python-2.7.12 yum install openssl openssl-devel zlib-devel gcc -y ./configure --prefix=/usr/local --with-zlib make && make altinstall ln -s /usr/local/bin/python2.7 /usr/bin/python27 wget https://bootstrap.pypa.io/get-pip.py python get-pip.py ln -s /usr/local/bin/pip2.7 /usr/bin/pip27

解決atomic repo 的gpg key 太舊造成的問題 The GPG keys listed for the "CentOS / Red Hat Enterprise Linux 6 - atomicrocketturtle.com" repository are already installed but they are not correct for this package

wget https://www.atomicorp.com/RPM-GPG-KEY.atomicorp.txt mv RPM-GPG-KEY.atomicorp.txt /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY.atomicorp.txt

解決mySQL 5.7 SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 問題

vi /etc/my.cnf 增加 [mysqld] sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION 儲存然後restart mysql 或者: mysql - u root - p mysql > SET GLOBAL sql_mode =( SELECT REPLACE (@@ sql_mode , 'ONLY_FULL_GROUP_BY' , '' )); 查了其他的資料, 原因如下: You need to specify all of the columns that you're not using for an aggregation function in your GROUP BY clause like this: select libelle , credit_initial , disponible_v , sum ( montant ) as montant FROM fiche , annee , type where type . id_type = annee . id_type and annee . id_annee = fiche . id_annee and annee = year ( current_timestamp ) GROUP BY libelle , credit_initial , disponible_v order by libelle asc The full_group_by mode basically makes you write more idiomatic SQL. You can turn off this setting if you'd like. There are different ways to do this that are outlined in the MySQL Documentation . Here's...

CentOS 6 安裝 Brotli HTTP 壓縮以取代 GZIP

yum install httpd-devel git clone --depth=1 --recursive https://github.com/kjdev/apache-mod-brotli.git cd apache-mod-brotli ./autogen.sh && ./configure && make install -p -m 755 -D .libs/mod_brotli.so /etc/httpd/modules/mod_brotli.so cd /etc/httpd/conf.d echo "LoadModule brotli_module modules/mod_brotli.so" > brotli.conf vi brotli.conf, 加入以下   # Compression   ## BrotliCompressionLevel: 0-11 (default: 11)   BrotliCompressionLevel 10   ## BrotliWindowSize: 10-24 (default: 22)   BrotliWindowSize 22    # Specifies how to change the ETag header when the response is compressed   ## BrotliAlterEtag: AddSuffix, NoChange, Remove (default: AddSuffix)   BrotliAlterEtag AddSuffix   # Logging   # Filter note   BrotliFilterNote Input  brotli_in   BrotliFilterNote Output brotli_out   BrotliFilterNote Ratio  brotli_ratio   LogFormat '"%r" %{brotli_out}n/%{brotli_in}n (%{brotli...

解決Apache 2.2, 關於HTTPS 之下使用PROXY 面對的 proxy server received an invalid response from an upstream server 以及 proxy: pass request body failed 的問題

修改以下 (proxy 以及 從proxy 接收的server): httpd.conf: ----------- 在 Include conf.d/*.conf 的前面加入以下: LimitRequestBody 2147483647  #2Gb Timeout 24000 ProxyTimeout 24000 ProxyBadHeader Ignore ssl.conf ---------- 在各個virtualhost 裡加入以下:     SSLEngine on     SSLProxyEngine on     SSLProxyVerify none     SSLProxyCheckPeerCN off     #SSLProxyCheckPeerName off     SSLProxyProtocol +SSLv3 +TLSv1 +TLSv1.1 +TLSv1.2 以下這個只在proxy server 裡的virtualhost 設定     ProxyPass / https://REMOTE_HOST:443/ retry=1 acquire=3000 timeout=3600 Keepalive=On 

解決在CentOS 6.8 無法使用vmware workstation 12 的問題

問題出在使用了 2.6.32-642 或以上的kernel 造成的, 因此: yum groupinstall "Development tools" yum install kernel-headers kernel-devel 然後開始安裝vmware, 之後 : 查看使用中的kernel   uname -r ln -s /lib/modules/2.6.32-642.3.1.el6.x86_64/build/include/linux /lib/modules/2.6.32-642.3.1.el6.x86_64/build/include/generated cd /usr/lib/vmware/modules/source/ tar xvf vmnet.tar cd vmnet-only/ vi netif.c 修改成以下: (comment lines 152, 153, 154 and 156) //#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(NET_NAME_USER) //   dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_USER, VNetNetIfSetup); //#else    dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup); //#endif 儲存然後退出 mv vmnet.tar vmnet.orig.tar tar cvf vmnet.tar vmnet-only 之後打開workstation

讓CentOS 支援 HTTP/2 的方法

yum groupinstall "Development Tools" wget http://www.us.apache.org/dist//apr/apr-1.5.2.tar.gz wget http://www.us.apache.org/dist//apr/apr-util-1.5.4.tar.gz wget https://github.com/tatsuhiro-t/nghttp2/releases/download/v1.4.0/nghttp2-1.4.0.tar.gz wget https://www.openssl.org/source/openssl-1.0.2d.tar.gz wget http://www.eu.apache.org/dist//httpd/httpd-2.4.18.tar.gz tar xvf apr-1.5.2.tar.gz cd apr-1.5.2 ./configure make make install cd .. tar xvf apr-util-1.5.4.tar.gz cd apr-util-1.5.4 ./configure --with-apr=/usr/local/apr/ make make install cd .. tar xvf nghttp2-1.4.0.tar.gz cd nghttp2-1.4.0 ./configure make make install cd .. tar xvf openssl-1.0.2d.tar.gz cd openssl-1.0.2d ./config shared make make install yum install pcre-devel zlib-devel libxml2-devel cd .. tar xvf httpd-2.4.18.tar.gz cd httpd-2.4.18.tar.gz cd httpd-2.4.18 make clean make distclean ./configure --enable-ssl --enable-so --enable-cache --enable-socache-memcache --e...

讓CentOS 6 也能安裝 Apache 2.4

網路上找到的方法如下: Step 1: cd /etc/yum.repos.d/ wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo Step 2: yum install httpd24.x86_64 Step 3: $ /opt/rh/httpd24/root/usr/sbin/httpd -version Server version: Apache/2.4.6 (Red Hat) Server built:   Sep 25 2013 05:25:46 NOTE: config files are in: /opt/rh/httpd24/root/etc/httpd $ ls conf  conf.d  conf.modules.d  logs  modules  run EDIT: in case you want to switch off Apache 2.2 $ chkconfig httpd off $ chkconfig --list | grep httpd httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off httpd24-httpd   0:off   1:off   2:off   3:off   4:off   5:off   6:off EDIT 2: http://wiki.apache.org/httpd/PHP-FPM yum install php-fpm /etc/init.d/php-fpm start service httpd24-httpd start