แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - golfreeze

Pages: 1 2 3 [4] 5 6 ... 73
47
all application on unix knowledges by golfreeze / limit bandwidth in linux app
« on: ธันวาคม 22, 2020, 02:29:26 PM »
https://www.tecmint.com/wondershaper-limit-network-bandwidth-in-linux/

สามารถใช้งาน wondershaper command ได้ครับ

#apt install wondershaper  [On Debian/Ubuntu]
$ sudo yum install wondershaper  [On CentOS/RHEL]
$ sudo dnf install wondershaper  [On Fedora 22+]

wondershaper -a wlp1s0 -d 4048 -u 1048

48
=== compile nginx1.19.5 with Lua on Centos7.x 64bit
yum install nginx-1.19.5

เราสามารถทำการ install ผ่าน repo nginx ของ nginx ได้ครับผม จะทำให้ง่ายกว่า แล้วค่อยมารัน compile module lua เพิ่มได้ครับผม

wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz
wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
wget https://github.com/chaoslawful/lua-nginx-module/archive/v0.10.10.zip
wget http://nginx.org/download/nginx-1.19.5.tar.gz
wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz

yum install gcc zlib-devel gcc-c++
yum install openssl-devel-1.0.2k openssl11-libs

cd /home/packetlove
tar zxvf v0.3.0.tar.gz
unzip -q v0.10.10.zip

tar zxf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
make && make install

tar zxf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make && make install

tar zxf nginx-1.19.5.tar.gz
cd nginx-1.19.5
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0

tar zxf nginx-1.19.5.tar.gz
cd nginx-1.19.5
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0

==ทำการ reconfigure module nginx ที่สำคัญคือเพิ่ม module lua เข้าไปครับ
== --add-module=../ngx_devel_kit-0.3.0/ --add-module=../lua-nginx-module-0.10.10/
./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'  --add-module=../ngx_devel_kit-0.3.0/ --add-module=../lua-nginx-module-0.10.10/
==make
make -j2 && make install
==link
ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

systemctl restart nginx
netstat -ntlp
เรียบร้อยครับผม
nginx -V ก็จะมี lua-nginx-module ขึ้นมาด้วยครับผม : )

49
ในกรณีเราติดตั้ง apache 2.4 อยู่บน centos 7 หรือ 8
โดยปกติแล้วจะมีการใช้งาน selinux เป็น
SELINUX=enforcing
SELINUXTYPE=targeted
 
เราต้องทำการ enable homedir ด้วยนะครับ เพราะปกติค่าตัวนี้จะถูกตั้งเป็น false
เลยทำให้ apache homedir ที่ใช้เป็น /home/user/public_html เวลาเรียกแล้วจะขึ้นเป้น error 403
getsebool -a | grep http

===enable homedir public_html
/home/gotomoon/public_html
setsebool -P httpd_enable_homedirs true

ลองเข้าหน้าเว็บอีกทีก็จะเรียกได้ปกติครับ  8)


50
=== download new version from
https://gitmemory.com/reubenyap
https://github.com/zcoinofficial/zcoin/releases/download/v0.14.0.5/zcoin-0.14.0.5-win64-setup.exe

=== Upgrade from zcoin-0.14.0.1-win64.exe to zcoin-0.14.0.5-win64.exe

Added “znodeblsprivkey” into file
===zcoin.conf in window locate on
C:\Users\Administrator\AppData\Roaming\zcoin\zcoin.conf

====  block you are stuck on. Memorize this number
https://zcoinkb.wordpress.com/2017/12/22/zcoin-wallet-shows-no-block-source-available-or-stuck-on-block/


Open your wallet and see which block you are stuck on. Memorize this number
Go to Help > Debug Window. In there, go to Console .
Subtract about 1,000 blocks from the block number you memorized
Now type getblockhash block# where block# is the block number from step 1 minus 1,000. Example: You’re stuck on block 62393, subtract 1,000 and a little more, type getblockhash 61000
Copy the resulting block hash
We are now invalidating this hash by typing invalidateblock copiedhash where copiedhash is – you guessed it – the copied hash from step 5
Great. Now you confused your poor wallet. Give it a nudge and ask it to reconsider the block by typing reconsiderblock copiedhash
Now your wallet will start syncing from this block onwards and once it’s done, you should be all set!

===then open zcoin-qt.exe program again
And see stuck on block:296903
Minus 1000 -> 295903
And choose 295900

===access “Help” -> “Debug” ->  to “console" in window
getblockhash 295900
a20bf26a75c90920a79595fb7aa50acc9954dsssxxxxxxxxxxxxxx

invalidateblock a20bf26a75c90920a79595fb7aa50acc9954dsssxxxxxxxxxxxxxx
null

reconsiderblock a20bf26a75c90920a79595fb7aa50acc9954dsssxxxxxxxxxxxxxx
null

==then zcoin console will re-sync again and pass that block

51
=== change selinux=targeted to  selinux=disabled
Then reboot found “Failed to load SELinux policy, freezing.
Random: cringe init done

ต้องบูตเข้า linux rescue
แล้วทำการ edit boot loader แก้ไข บันทัดที่มี linux16
ให้เพิ่ม selinux=0 ก่อนหน้า ro
แล้วทำการ ctrl+x เพื่อ boot ตัวที่แก้ไข ก็จะเข้าได้

52
Nodejs Nginx error: (13: Permission denied) while connecting to upstream
ถ้าเจอเรื่อง permission denied ของ nginx
ถึงแม้จะแก้ไขเรื่อง chmod , chown เรียบร้อยแล้ว ก็ยังเป็นอยู่
ให้ลองเชค selinux อีกทีนะครับ ว่ามีใช้งาน mode ไหน
หรือจะเปิดให้ httpd เข้าใช้งาน network ได้
setsebool -P httpd_can_network_connect 1

หรือบางทีเป็นที่ codeignetor ไม่สามารถเขียน sessions ลงใน folder system/cache/sessions ได้
ให้ลองเชคที่ selinux ดูนะครับผม : )

53
=== Rootclause  :  PostgreSQL v10 and v11
 ===check replicate log make disk full
 postgres=> select slot_name, pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(),restart_lsn)) as replicationSlotLag, active from pg_replication_slots;

            slot_name             | replicationslotlag | active
----------------------------------+--------------------+--------
 re_sub                | 64 MB              | t
 replication_slot1  | 904 GB             | f
 replication_slot2  | 904 GB             | f

(3 rows)

เราสามารถทำการ drop slot ที่กินพื้นที่ได้ ดังนี้
postgres=# SELECT pg_drop_replication_slot('replication_slot1');
postgres=# SELECT pg_drop_replication_slot('replication_slot2');

แล้วทำการปรับ purge delete log จาก default 3 วัน (4320minute) เป็น 1 วัน (1440minute)ได้ครับ
rds.log_retention_period = 1440
แล้วทำการ  restart service 1 ทีครับ

54
custom memory_limit for user da

cd /usr/local/directadmin/data/users/php
vi php-fpm74.conf

edit
memory_limit=256MB

==restart service 1 times
/usr/local/etc/rc.d/php-fpm74 restart

55
ถ้ามีการอัฟเกรดระบบ และถ้ามีการเรียกอัฟเกรด xz ไปด้วย จะทำให้ตอน boot os เจอ error ประมาณนี้ครับ
xz /usr/local/lib/liblzma.so.5 version XZ 5.2.2 not found (required by xz)
/lib64/liblzma.so.5: version `XZ_5.1.2alpha' not found (required by /lib/librpmio.so.5)

ทำการแก้ไขโดยใช้ ISO ของ CentOS7.x image โหลดเข้า "linux rescue" mode
ทำการเข้าไปในโหมด Option 1 (Continue) to get to the shell.

mount --bind /proc /mnt/sysimage/proc
mount --bind /dev /mnt/sysimage/dev
mount --bind /sys /mnt/sysimage/sys
chroot /mnt/sysimage
cd /usr/local/lib
unlink liblzma.so.5
ln -s /usr/lib64/liblzma.so.5  /usr/local/lib/liblzma.so.5

dracut -f
exit
cd /
sync
telinit 6

56
ทำการเพิ่ม
   location ~ .php$ {
                try_files $uri =404;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

ลงไปในแถบ server ใน nginx.conf ดังข้างล่างครับ

vi /etc/nginx/nginx.conf

server {
    server_name www.packetlove.com packetlove.com; # managed by Certbot
        index index.php index.html index.htm;
        root         /var/www/it-money.com/public_html;
        include snippets/phpMyAdmin.conf;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        if ( !-e $request_filename ){
                rewrite ^/(.*)$ /index.php?/$1 last;
                break;
        }

        location / {
                try_files $uri $uri/ /index.html;
        }

         location ~ .php$ {
                try_files $uri =404;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
....

หลังจากนั้นทำการ restart nginx 1 รอบ

57
command , shell script ,tool , crontab / added routing in centos 8.x
« on: กรกฎาคม 22, 2020, 08:14:15 PM »
ถ้าต้องการทำ static route ใน centos 8.x เช่น
192.168.0.0/16 ให้วิ่งออก 192.168.1.254 สามารถทำได้ดังนี้
172.30.0.0/16 ให้วิ่งออก 192.168.1.254 สามารถทำได้ดังนี้

vi /etc/sysconfig/network-scripts/route-ens160
192.168.0.0/16 via 192.168.1.254
172.30.0.0/16 via 192.168.1.254


58
all application on unix knowledges by golfreeze / rufus burn iso to boot disk usb on window 10
« on: มิถุนายน 23, 2020, 01:26:58 PM »
rufus burn iso to boot disk usb on window 10
https://github.com/pbatard/rufus/releases/download/v3.11/rufus-3.11.exe

หรือเข้าไป download จาก https://rufus.ie

59
/usr/local/etc/rc.d/pure-ftpd: WARNING: run_rc_command: cannot run /usr/local/sbin/pure-config.pl

=== re-build pureftpd & dovecot again.
cd /usr/local/directadmin/custombuild
Check versions.txt see pureftpd if found version then
./build pureftpd
./build dovecot

60
=== freebsd 11.x 64bit compile directadmin and failed on snail

/usr/local/directadmin/custombuild/s-nail-14.9.19/src/mx/xtls.c:1937:20: warning: incompatible integer to pointer conversion assigning to 'const EVP_MD *'
      (aka 'const struct env_md_st *') from 'int' [-Wint-conversion]
         fprnt_mdp = a_XTLS_FINGERPRINT_DEFAULT_DIGEST();
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/directadmin/custombuild/s-nail-14.9.19/src/mx/xtls.c:1942:27: warning: implicit declaration of function 'TLS_client_method' is invalid in C99
      [-Wimplicit-function-declaration]
   if((ctxp = SSL_CTX_new(mx_XTLS_CLIENT_METHOD())) == NULL){
                          ^
/usr/local/directadmin/custombuild/s-nail-14.9.19/include/mx/gen-config.h:379:31: note: expanded from macro 'mx_XTLS_CLIENT_METHOD'
#define mx_XTLS_CLIENT_METHOD TLS_client_method
                              ^
/usr/local/directadmin/custombuild/s-nail-14.9.19/src/mx/xtls.c:1942:27: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const SSL_METHOD *'
      (aka 'const struct ssl_method_st *') [-Wint-conversion]
   if((ctxp = SSL_CTX_new(mx_XTLS_CLIENT_METHOD())) == NULL){
                          ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/directadmin/custombuild/s-nail-14.9.19/include/mx/gen-config.h:379:31: note: expanded from macro 'mx_XTLS_CLIENT_METHOD'
#define mx_XTLS_CLIENT_METHOD TLS_client_method
                              ^
/usr/include/openssl/ssl.h:2131:40: note: passing argument to parameter 'meth' here
SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
                                       ^
4 warnings and 7 errors generated.
gmake[1]: *** [mk-config.mk:421: mx-072.o] Error 1
gmake[1]: Leaving directory '/usr/local/directadmin/custombuild/s-nail-14.9.19/.obj'
gmake: *** [makefile:25: build] Error 2
Could not find /usr/local/directadmin/scripts/directadmin_cron or it is empty

====> how to fixed
snail is use your old openssl and not openssl 1.1.1

and also my problem in the past.

You may set 0 as the version in custom_versions.txt for it.
cd /usr/local/directadmin/custombuild
vi custom_versions.txt
s-nail:0

=== manually install s-nail package in freebsd
pkg install s-nail

===then run setup again.
./setup auto

Pages: 1 2 3 [4] 5 6 ... 73