栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

NAC1.33安装文档

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

NAC1.33安装文档

目录
  • 1.配置基础环境
  • 2. 安装supervisord
  • 3. 安装nginx
  • 4. 安装postgresql
  • 5. 安装redis
  • 6. 安装python3.8和devel全库
  • 7. 安装python运行包库
  • 8. 安装网络工具
  • 9. 替换so和ko文件
  • 10. 开放防火墙端口
  • 11. 创建下载链接
  • 12. 访问web页面验证效果

1.配置基础环境
//上传离线安装包
[root@localhost home]# ls
yihnac--v1.3.3.zip
[root@localhost home]# unzip yihnac--v1.3.3.zip
[root@localhost home]# rm -rf yihnac--v1.3.3.zip 
[root@localhost home]# ll
total 12820
drwxr-xr-x. 2 root root      268 Jun 16 18:19 kernel
drwxr-xr-x. 2 root root      254 Jun 16 18:19 libs
drwxr-xr-x. 4 root root      199 Jun 16 18:19 network_toolkit
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 nginx
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 pgsql_13.6
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 py
drwxr-xr-x. 2 root root       66 Jun 16 18:19 redis
drwxr-xr-x. 2 root root     4096 Jun 16 18:19 se
drwxr-xr-x. 3 root root       85 Jun 16 18:19 supervisor
-rw-r--r--. 1 root root 13109392 Jun 16 19:07 ts_iot_sams.ko
drwxr-xr-x. 2 root root      128 Jun 16 18:19 usrlocalbin
drwxr-xr-x. 5 root root       65 Jun 16 19:08 web
drwxr-xr-x. 9 root root      180 Jun 16 19:10 yihnac
[root@localhost home]# 
//查看内核版本
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-305.3.1.el8.x86_64 #1 SMP Tue Jun 1 16:14:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# 
//内核版本太低,升级内核版本
[root@localhost home]# cd /home/kernel/
[root@localhost kernel]# ll
total 97644
-rw-r--r--. 1 root root  6181972 Jun 16 18:19 kernel-4.18.0-305.19.1.el8_4.x86_64.rpm
-rw-r--r--. 1 root root 37568204 Jun 16 18:19 kernel-core-4.18.0-305.19.1.el8_4.x86_64.rpm
-rw-r--r--. 1 root root 19304000 Jun 16 18:19 kernel-devel-4.18.0-305.19.1.el8_4.x86_64.rpm
-rw-r--r--. 1 root root  7494560 Jun 16 18:19 kernel-headers-4.18.0-305.19.1.el8_4.x86_64.rpm
-rw-r--r--. 1 root root 29432492 Jun 16 18:19 kernel-modules-4.18.0-305.19.1.el8_4.x86_64.rpm
[root@localhost kernel]# rpm -ivh *.rpm --force --nodeps

//安装完内核之后重启机器,再次查看版本
[root@localhost ~]# reboot
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-305.19.1.el8_4.x86_64 #1 SMP Wed Sep 15 15:39:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
2. 安装supervisord
//安装python3.6环境
[root@localhost ~]# cd /home/supervisor/py36_for_spv/
[root@localhost py36_for_spv]# ll
total 2580
-rw-r--r--. 1 root root 1780732 Jun 16 18:19 platform-python-pip-9.0.3-20.el8.noarch.rpm
-rw-r--r--. 1 root root  647436 Jun 16 18:19 platform-python-setuptools-39.2.0-6.el8.noarch.rpm
-rw-r--r--. 1 root root   19806 Jun 16 18:19 python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64.rpm
-rw-r--r--. 1 root root   20340 Jun 16 18:19 python3-pip-9.0.3-20.el8.noarch.rpm
-rw-r--r--. 1 root root  166496 Jun 16 18:19 python3-setuptools-39.2.0-6.el8.noarch.rpm
[root@localhost py36_for_spv]# rpm -ivh *.rpm --force --nodeps
[root@localhost py36_for_spv]# 

//安装supervisord
[root@localhost ~]# cd /home/supervisor/
[root@localhost supervisor]# ls
py36_for_spv  supervisor-4.2.2-1.el8.noarch.rpm  yihnac.ini
[root@localhost supervisor]# rpm -ivh supervisor-4.2.2-1.el8.noarch.rpm 
[root@localhost supervisor]# systemctl enable --now supervisord
Created symlink /etc/systemd/system/multi-user.target.wants/supervisord.service → /usr/lib/systemd/system/supervisord.service.
//将配置文件ini复制到启动目录下
[root@localhost supervisor]# cp yihnac.ini /etc/supervisord.d/
[root@localhost supervisor]# mkdir -p /yihnac/log
[root@localhost supervisor]# systemctl restart supervisord
3. 安装nginx
//安装nginx
[root@localhost ~]# cd /home/nginx/
[root@localhost nginx]# ll
total 908
drwxr-xr-x. 2 root root     55 Jun 16 18:19 conf.d
-rw-r--r--. 1 root root 583548 Jun 16 18:19 nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm
-rw-r--r--. 1 root root  24040 Jun 16 18:19 nginx-all-modules-1.14.1-9.module_el8.0.0+184+e34fea82.noarch.rpm
-rw-r--r--. 1 root root   4986 Jun 16 18:19 nginx.conf
-rw-r--r--. 1 root root  24916 Jun 16 18:19 nginx-filesystem-1.14.1-9.module_el8.0.0+184+e34fea82.noarch.rpm
-rw-r--r--. 1 root root  35624 Jun 16 18:19 nginx-mod-http-image-filter-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm
-rw-r--r--. 1 root root  46588 Jun 16 18:19 nginx-mod-http-perl-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm
-rw-r--r--. 1 root root  34260 Jun 16 18:19 nginx-mod-http-xslt-filter-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm
-rw-r--r--. 1 root root  65612 Jun 16 18:19 nginx-mod-mail-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm
-rw-r--r--. 1 root root  87456 Jun 16 18:19 nginx-mod-stream-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm
[root@localhost nginx]# rpm -ivh *.rpm --force --nodeps
warning: nginx-1.14.1-9.module_el8.0.0+184+e34fea82.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:nginx-filesystem-1:1.14.1-9.modul################################# [ 13%]
   2:nginx-mod-http-image-filter-1:1.1################################# [ 25%]
   3:nginx-mod-http-perl-1:1.14.1-9.mo################################# [ 38%]
   4:nginx-mod-http-xslt-filter-1:1.14################################# [ 50%]
   5:nginx-mod-mail-1:1.14.1-9.module_################################# [ 63%]
   6:nginx-all-modules-1:1.14.1-9.modu################################# [ 75%]
   7:nginx-1:1.14.1-9.module_el8.0.0+1################################# [ 88%]
   8:nginx-mod-stream-1:1.14.1-9.modul################################# [100%]
[root@localhost nginx]# 
[root@localhost nginx]# systemctl enable --now nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
[root@localhost nginx]# cp nginx.conf /etc/nginx/
cp: overwrite '/etc/nginx/nginx.conf'? y
[root@localhost nginx]# systemctl restart nginx

//配置web文件
[root@localhost ~]# cd /home/web/
[root@localhost web]# ll
total 0
drwxr-xr-x. 4 root root 89 Jun 16 19:07 yihnac_cent
drwxr-xr-x. 4 root root 89 Jun 16 19:08 yihnac_probe
drwxr-xr-x. 4 root root 89 Jun 16 19:08 yihnac_reset
[root@localhost web]# cp -r yihnac_cent/ /usr/share/nginx/
[root@localhost web]# cp -r yihnac_probe/ /usr/share/nginx/
[root@localhost web]# cp -r yihnac_reset/ /usr/share/nginx/
[root@localhost ~]# cd /usr/share/nginx/
[root@localhost nginx]# ll
total 0
drwxr-xr-x. 2 root root  99 Jul  2 23:21 html
drwxr-xr-x. 2 root root 143 Jul  2 23:21 modules
drwxr-xr-x. 4 root root  89 Jul  2 23:26 yihnac_cent
drwxr-xr-x. 4 root root  89 Jul  2 23:26 yihnac_probe
drwxr-xr-x. 4 root root  89 Jul  2 23:27 yihnac_reset

//创建dlf目录,并给目录授权
[root@localhost nginx]# mkdir -p /usr/share/nginx/downloadfile/media
[root@localhost nginx]# chcon -Rt httpd_sys_content_t /usr/share/nginx/downloadfile/

4. 安装postgresql
//安装pgsql
[root@localhost ~]# cd /home/pgsql_13.6/
[root@localhost pgsql_13.6]# ll
total 15920
drwxr-xr-x. 2 root root    4096 Jun 16 18:19 devel
-rw-r--r--. 1 root root 1538848 Jun 16 18:19 postgresql13-13.6-1PGDG.rhel8.x86_64.rpm
-rw-r--r--. 1 root root  424764 Jun 16 18:19 postgresql13-libs-13.6-1PGDG.rhel8.x86_64.rpm
-rw-r--r--. 1 root root 5812304 Jun 16 18:19 postgresql13-server-13.6-1PGDG.rhel8.x86_64.rpm
-rw-r--r--. 1 root root 7642992 Jun 16 18:19 run_sql_file
-rw-r--r--. 1 root root  458052 Jun 16 18:19 yihnac_Insert.sql
-rw-r--r--. 1 root root  213394 Jun 16 18:19 yihnacTableDef_6-15.sql
-rw-r--r--. 1 root root  195363 Jun 16 18:19 yihnac_TableDef_v1.32.sql
[root@localhost pgsql_13.6]# rpm -ivh *.rpm --nodeps --force
[root@localhost pgsql_13.6]# cd /usr/pgsql-13/bin/
[root@localhost bin]# postgresql-13-setup initdb 
Initializing database ... OK
[root@localhost bin]# systemctl enable --now postgresql-13
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-13.service → /usr/lib/systemd/system/postgresql-13.service.
[root@localhost bin]# 

//设置密码
[root@localhost bin]# su postgres
bash-4.4$ psql
psql (13.6)
Type "help" for help.

postgres=# ALTER USER postgres WITH PASSWORD 'xxx';
ALTER ROLE
postgres=# q
bash-4.4$ exit
exit
[root@localhost bin]# 
//修改postgresql配置文件
[root@localhost bin]# cat >> /var/lib/pgsql/13/data/postgresql.conf < 
//切换到sams库中导入sql文件
postgres=# c sams 
You are now connected to database "sams" as user "postgres".
sams=# i /home/pgsql_13.6/yihnac_TableDef_v1.32.sql 
sams=# dt
                    List of relations
 Schema |             Name             | Type  |  Owner   
--------+------------------------------+-------+----------
 public | access                       | table | postgres
 public | access_dict_param            | table | postgres
 public | access_object                | table | postgres
 public | access_role                  | table | postgres
 public | access_role_range            | table | postgres
 public | access_rule                  | table | postgres
 public | access_version               | table | postgres
 public | access_web                   | table | postgres
 public | acl_group                    | table | postgres
 public | acl_ip                       | table | postgres
 public | acl_rule_ip                  | table | postgres
 public | acl_rule_release             | table | postgres
 public | acl_user                     | table | postgres
 public | auth_group                   | table | postgres
 public | auth_group_permissions       | table | postgres
 public | auth_permission              | table | postgres
 public | config_auto_escape           | table | postgres
 public | config_core_netinfo          | table | postgres
 public | config_detection_snmp        | table | postgres
 public | config_dict_detsnmp          | table | postgres
 public | config_fingerprint           | table | postgres
 public | config_ip_scan               | table | postgres
 public | config_mfacturer_oid         | table | postgres
 public | config_nmap_argument         | table | postgres
 public | config_record_http           | table | postgres
 public | config_scan_task             | table | postgres
 public | config_scan_time             | table | postgres
 public | config_service_discern       | table | postgres
 public | config_snmp                  | table | postgres
 public | core_info                    | table | postgres
 public | dev_arch_dict                | table | postgres
 public | dev_arch_info                | table | postgres
 public | dev_arch_relation            | table | postgres
 public | dev_auth_status              | table | postgres
 public | dev_dict_label               | table | postgres
sams=# i /home/pgsql_13.6/yihnac_Insert.sql;
[root@localhost bin]# cd /home/pgsql_13.6/
[root@localhost pgsql_13.6]# ll
total 15920
drwxr-xr-x. 2 root root    4096 Jun 16 18:19 devel
-rw-r--r--. 1 root root 1538848 Jun 16 18:19 postgresql13-13.6-1PGDG.rhel8.x86_64.rpm
-rw-r--r--. 1 root root  424764 Jun 16 18:19 postgresql13-libs-13.6-1PGDG.rhel8.x86_64.rpm
-rw-r--r--. 1 root root 5812304 Jun 16 18:19 postgresql13-server-13.6-1PGDG.rhel8.x86_64.rpm
-rw-r--r--. 1 root root 7642992 Jun 16 18:19 run_sql_file
-rw-r--r--. 1 root root  458052 Jun 16 18:19 yihnac_Insert.sql
-rw-r--r--. 1 root root  213394 Jun 16 18:19 yihnacTableDef_6-15.sql
-rw-r--r--. 1 root root  195363 Jun 16 18:19 yihnac_TableDef_v1.32.sql
[root@localhost pgsql_13.6]# chmod +x run_sql_file 
[root@localhost pgsql_13.6]# ./run_sql_file -u postgresql+psycopg2://postgres:xxx@127.0.0.1:5432/sams-probe-rec -d /home/table_sql
5. 安装redis
//安装redis
[root@localhost ~]# cd /home/redis/
[root@localhost redis]# ll
total 928
-rw-r--r--. 1 root root 946949 Jun 16 18:19 redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64.rpm
[root@localhost redis]# rpm -ivh *.rpm --nodeps --force 
warning: redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:redis-5.0.3-2.module_el8.2.0+318+################################# [100%]
[root@localhost redis]# 
[root@localhost redis]# sed -i '507s/# requirepass foobared/requirepass sams@xxx/' /etc/redis.conf 
[root@localhost redis]# systemctl enable --now redis
Created symlink /etc/systemd/system/multi-user.target.wants/redis.service → /usr/lib/systemd/system/redis.service.
[root@localhost redis]# 

6. 安装python3.8和devel全库
//python
[root@localhost ~]# cd /home/py/
[root@localhost py]# ll
total 12980
-rw-r--r--. 1 root root   80542 Jun 16 18:19 python38-3.8.6-3.module_el8.4.0+665+abc3a503.x86_64.rpm
-rw-r--r--. 1 root root  282066 Jun 16 18:19 python38-devel-3.8.6-3.module_el8.4.0+665+abc3a503.x86_64.rpm
-rw-r--r--. 1 root root 8690130 Jun 16 18:19 python38-libs-3.8.6-3.module_el8.4.0+665+abc3a503.x86_64.rpm
-rw-r--r--. 1 root root 1952934 Jun 16 18:19 python38-pip-19.3.1-1.module_el8.4.0+647+0ba99ce8.noarch.rpm
-rw-r--r--. 1 root root 1255434 Jun 16 18:19 python38-pip-wheel-19.3.1-1.module_el8.4.0+647+0ba99ce8.noarch.rpm
-rw-r--r--. 1 root root  683170 Jun 16 18:19 python38-setuptools-41.6.0-4.module_el8.4.0+647+0ba99ce8.noarch.rpm
-rw-r--r--. 1 root root  310934 Jun 16 18:19 python38-setuptools-wheel-41.6.0-4.module_el8.4.0+647+0ba99ce8.noarch.rpm
-rw-r--r--. 1 root root   25264 Jun 16 18:19 python3-rpm-generators-5-7.el8.noarch.rpm
drwxr-xr-x. 4 root root      60 Jun 16 18:19 pyyl
[root@localhost py]# rpm -ivh *.rpm --nodeps --force
//修改python默认环境为python3,8
[root@localhost ~]# cd /etc/alternatives/

//删除python3的软连接
[root@localhost alternatives]# rm -rf python3

//新建python3的软连接指定python3.8
[root@localhost alternatives]# ln -s /usr/bin/python3.8 python3

//删除pip3的软连接
[root@localhost alternatives]# rm -rf pip3

//新建pip3的软连接指定pip3.8
[root@localhost alternatives]# ln -s /usr/bin/pip3.8 pip3

//查看软链接
[root@localhost alternatives]# ll | grep python
lrwxrwxrwx. 1 root root 22 Apr 11 19:15 python -> /usr/libexec/no-python
lrwxrwxrwx. 1 root root 18 Jul  2 23:57 python3 -> /usr/bin/python3.8
lrwxrwxrwx. 1 root root 34 Jul  2 23:00 python3-man -> /usr/share/man/man1/python3.6.1.gz
lrwxrwxrwx. 1 root root 43 Apr 11 19:15 unversioned-python-man -> /usr/share/man/man1/unversioned-python.1.gz
[root@localhost alternatives]# ll | grep pip
lrwxrwxrwx. 1 root root 16 Jul  2 23:00 pip-3 -> /usr/bin/pip-3.6
lrwxrwxrwx. 1 root root 15 Jul  2 23:58 pip3 -> /usr/bin/pip3.8
[root@localhost alternatives]# 
[root@localhost alternatives]# python3
Python 3.8.6 (default, Jan 29 2021, 17:38:16) 
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

//复制代码到/yihnac
[root@localhost yihnac]# ll
total 16
drwxr-xr-x. 12 root root 4096 Jun 16 19:09 center-core-server
drwxr-xr-x.  7 root root  205 Jun 16 19:09 center-web-etl
drwxr-xr-x.  9 root root  182 Jun 16 19:09 center-web-server
drwxr-xr-x.  2 root root 4096 Jun 16 19:10 log
drwxr-xr-x. 10 root root 4096 Jun 16 19:09 prober-core-server
drwxr-xr-x.  6 root root  178 Jun 16 19:10 prober-web-server
-rw-r--r--.  1 root root  600 Jun 16 19:10 settings.conf
drwxr-xr-x.  3 root root   17 Jun 16 19:10 supervisor
[root@localhost yihnac]# rm -rf log/ supervisor/
[root@localhost yihnac]# ll
total 12
drwxr-xr-x. 12 root root 4096 Jun 16 19:09 center-core-server
drwxr-xr-x.  7 root root  205 Jun 16 19:09 center-web-etl
drwxr-xr-x.  9 root root  182 Jun 16 19:09 center-web-server
drwxr-xr-x. 10 root root 4096 Jun 16 19:09 prober-core-server
drwxr-xr-x.  6 root root  178 Jun 16 19:10 prober-web-server
-rw-r--r--.  1 root root  600 Jun 16 19:10 settings.conf
[root@localhost yihnac]# cp -r * /yihnac/
[root@localhost ~]# cd /yihnac/
[root@localhost yihnac]# ll
total 16
drwxr-xr-x. 12 root root 4096 Jul  3 00:04 center-core-server
drwxr-xr-x.  7 root root  205 Jul  3 00:04 center-web-etl
drwxr-xr-x.  9 root root  182 Jul  3 00:04 center-web-server
drwxr-xr-x.  2 root root 4096 Jul  2 23:08 log
drwxr-xr-x. 10 root root 4096 Jul  3 00:04 prober-core-server
drwxr-xr-x.  6 root root  178 Jul  3 00:04 prober-web-server
-rw-r--r--.  1 root root  600 Jul  3 00:04 settings.conf
[root@localhost yihnac]# 

7. 安装python运行包库
[root@localhost ~]# cd /home/py/pyyl/
[root@localhost pyyl]# cd pg-rpm/
[root@localhost pg-rpm]# ll
total 18116
-rw-r--r--. 1 root root  131796 Jun 16 18:19 cyrus-sasl-lib-2.1.27-5.el8.i686.rpm
-rw-r--r--. 1 root root  126192 Jun 16 18:19 cyrus-sasl-lib-2.1.27-5.el8.x86_64.rpm
-rw-r--r--. 1 root root 3595752 Jun 16 18:19 glibc-2.28-164.el8.i686.rpm
-rw-r--r--. 1 root root 3818248 Jun 16 18:19 glibc-2.28-164.el8.x86_64.rpm
-rw-r--r--. 1 root root 1378856 Jun 16 18:19 glibc-common-2.28-164.el8.x86_64.rpm
-rw-r--r--. 1 root root 1076668 Jun 16 18:19 glibc-devel-2.28-164.el8.x86_64.rpm
-rw-r--r--. 1 root root  491176 Jun 16 18:19 glibc-headers-2.28-164.el8.x86_64.rpm
-rw-r--r--. 1 root root  847924 Jun 16 18:19 glibc-langpack-en-2.28-164.el8.x86_64.rpm
-rw-r--r--. 1 root root   35052 Jun 16 18:19 keyutils-libs-1.5.10-9.el8.i686.rpm
-rw-r--r--. 1 root root  926944 Jun 16 18:19 krb5-libs-1.18.2-14.el8.i686.rpm
-rw-r--r--. 1 root root   50520 Jun 16 18:19 libcom_err-1.45.6-2.el8.i686.rpm
-rw-r--r--. 1 root root  844532 Jun 16 18:19 libdb-5.3.28-42.el8_4.i686.rpm
-rw-r--r--. 1 root root  769396 Jun 16 18:19 libdb-5.3.28-42.el8_4.x86_64.rpm
-rw-r--r--. 1 root root  153236 Jun 16 18:19 libdb-utils-5.3.28-42.el8_4.x86_64.rpm
-rw-r--r--. 1 root root  212132 Jun 16 18:19 libpq-13.3-1.el8_4.i686.rpm
-rw-r--r--. 1 root root  201952 Jun 16 18:19 libpq-13.3-1.el8_4.x86_64.rpm
-rw-r--r--. 1 root root  101112 Jun 16 18:19 libpq-devel-13.3-1.el8_4.i686.rpm
-rw-r--r--. 1 root root   99228 Jun 16 18:19 libpq-devel-13.3-1.el8_4.x86_64.rpm
-rw-r--r--. 1 root root  175732 Jun 16 18:19 libselinux-2.9-5.el8.i686.rpm
-rw-r--r--. 1 root root  375076 Jun 16 18:19 libsepol-2.9-3.el8.i686.rpm
-rw-r--r--. 1 root root   25520 Jun 16 18:19 libverto-0.3.0-5.el8.i686.rpm
-rw-r--r--. 1 root root   76076 Jun 16 18:19 libxcrypt-4.1.1-6.el8.i686.rpm
-rw-r--r--. 1 root root   74480 Jun 16 18:19 libxcrypt-4.1.1-6.el8.x86_64.rpm
-rw-r--r--. 1 root root   25808 Jun 16 18:19 libxcrypt-devel-4.1.1-6.el8.x86_64.rpm
-rw-r--r--. 1 root root  380184 Jun 16 18:19 openldap-2.4.46-18.el8.i686.rpm
-rw-r--r--. 1 root root  360924 Jun 16 18:19 openldap-2.4.46-18.el8.x86_64.rpm
-rw-r--r--. 1 root root  207188 Jun 16 18:19 openldap-clients-2.4.46-18.el8.x86_64.rpm
-rw-r--r--. 1 root root 1550816 Jun 16 18:19 openssl-libs-1.1.1k-5.el8_5.i686.rpm
-rw-r--r--. 1 root root  252352 Jun 16 18:19 pcre2-10.32-2.el8.i686.rpm
-rw-r--r--. 1 root root   15372 Jun 16 18:19 python-rpm-macros-3-41.el8.noarch.rpm
-rw-r--r--. 1 root root  107340 Jun 16 18:19 zlib-1.2.11-17.el8.i686.rpm
[root@localhost pg-rpm]# rpm -ivh *.rpm --nodeps --force
[root@localhost pg-rpm]# cd /home/py/pyyl/pypackets/
[root@localhost pypackets]# pip3 install pbr-5.8.1-py2.py3-none-any.whl
[root@localhost pypackets]# pip3 install func_timeout-4.3.5.tar.gz
[root@localhost pypackets]# pip3 install filetype-1.0.13-py2.py3-none-any.whl
[root@localhost pypackets]# cd pandas/
[root@localhost pandas]# ll
total 26316
-rw-r--r--. 1 root root 16847205 Jun 16 18:19 numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
-rw-r--r--. 1 root root  9328954 Jun 16 18:19 pandas-1.1.5-cp38-cp38-manylinux1_x86_64.whl
-rw-r--r--. 1 root root   247702 Jun 16 18:19 python_dateutil-2.8.2-py2.py3-none-any.whl
-rw-r--r--. 1 root root   503520 Jun 16 18:19 pytz-2022.1-py2.py3-none-any.whl
-rw-r--r--. 1 root root    11053 Jun 16 18:19 six-1.16.0-py2.py3-none-any.whl
[root@localhost pandas]# pip3 install *
[root@localhost pandas]# cd ../aiohttp/
[root@localhost aiohttp]# pip3 install *
[root@localhost pyyl]# pwd
/home/py/pyyl
[root@localhost pyyl]# ll
total 20
drwxr-xr-x. 2 root root 4096 Jun 16 18:19 pg-rpm
drwxr-xr-x. 4 root root 8192 Jun 16 18:19 pypackets
-rw-r--r--. 1 root root 2104 Jun 16 18:19 requirement.txt
[root@localhost pyyl]# pip3 install -r requirement.txt -i --no-index --find-links=./pypackets
8. 安装网络工具
[root@localhost ~]# cd /home/network_toolkit/
[root@localhost network_toolkit]# ll
total 936
drwxr-xr-x. 2 root root   4096 Jun 16 18:19 net_snmp
-rw-r--r--. 1 root root 329380 Jun 16 18:19 net-tools-2.0-0.52.20160912git.el8.x86_64.rpm
-rw-r--r--. 1 root root  84068 Jun 16 18:19 nload-0.7.4-16.el8.x86_64.rpm
drwxr-xr-x. 2 root root     79 Jun 16 18:19 nmap
-rw-r--r--. 1 root root 462604 Jun 16 18:19 tcpdump-4.9.3-1.el8.x86_64.rpm
-rw-r--r--. 1 root root  73564 Jun 16 18:19 telnet-0.17-76.el8.x86_64.rpm
[root@localhost network_toolkit]# cd nmap/
[root@localhost nmap]# ls
nmap-7.70-5.el8.x86_64.rpm  nmap-ncat-7.70-5.el8.x86_64.rpm
[root@localhost nmap]# rpm -ivh *
[root@localhost nmap]# cd ../net_snmp/
[root@localhost net_snmp]# rpm -ivh *.rpm
[root@localhost network_toolkit]# pwd
/home/network_toolkit
[root@localhost network_toolkit]# ll
total 936
drwxr-xr-x. 2 root root   4096 Jun 16 18:19 net_snmp
-rw-r--r--. 1 root root 329380 Jun 16 18:19 net-tools-2.0-0.52.20160912git.el8.x86_64.rpm
-rw-r--r--. 1 root root  84068 Jun 16 18:19 nload-0.7.4-16.el8.x86_64.rpm
drwxr-xr-x. 2 root root     79 Jun 16 18:19 nmap
-rw-r--r--. 1 root root 462604 Jun 16 18:19 tcpdump-4.9.3-1.el8.x86_64.rpm
-rw-r--r--. 1 root root  73564 Jun 16 18:19 telnet-0.17-76.el8.x86_64.rpm
[root@localhost network_toolkit]# rpm -ivh net-tools-2.0-0.52.20160912git.el8.x86_64.rpm
[root@localhost network_toolkit]# rpm -ivh telnet-0.17-76.el8.x86_64.rpm
[root@localhost network_toolkit]# rpm -ivh tcpdump-4.9.3-1.el8.x86_64.rpm
[root@localhost network_toolkit]# rpm -ivh nload-0.7.4-16.el8.x86_64.rpm
9. 替换so和ko文件
[root@localhost network_toolkit]# cp /home/libs/* /usr/lib64/
[root@localhost home]# ll
total 12820
drwxr-xr-x. 2 root root      268 Jun 16 18:19 kernel
drwxr-xr-x. 2 root root      254 Jun 16 18:19 libs
drwxr-xr-x. 4 root root      199 Jun 16 18:19 network_toolkit
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 nginx
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 pgsql_13.6
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 py
drwxr-xr-x. 2 root root       66 Jun 16 18:19 redis
drwxr-xr-x. 2 root root     4096 Jun 16 18:19 se
drwxr-xr-x. 3 root root       85 Jun 16 18:19 supervisor
-rw-r--r--. 1 root root 13109392 Jun 16 19:07 ts_iot_sams.ko
drwxr-xr-x. 2 root root      128 Jun 16 18:19 usrlocalbin
drwxr-xr-x. 5 root root       65 Jun 16 19:08 web
drwxr-xr-x. 7 root root      151 Jul  3 00:03 yihnac
[root@localhost home]# cd usrlocalbin/
[root@localhost usrlocalbin]# ll
total 272
-rw-r--r--. 1 root root    593 Jun 16 18:19 ifinfo
-rw-r--r--. 1 root root   2174 Jun 16 18:19 nacipmodify.sh
-rw-r--r--. 1 root root   1551 Jun 16 18:19 nacsetrole
-rw-r--r--. 1 root root   1028 Jun 16 18:19 netconfig
-rw-r--r--. 1 root root   1028 Jun 16 18:19 setbr
-rw-r--r--. 1 root root   4331 Jun 16 18:19 setifname.sh
-rw-r--r--. 1 root root 248936 Jun 16 18:19 ts_iot_msg
[root@localhost usrlocalbin]# chmod +x {ifinfo,nacipmodify.sh,nacsetrole,netconfig,setbr,setifname.sh,ts_iot_msg}
[root@localhost usrlocalbin]# ll
total 272
-rwxr-xr-x. 1 root root    593 Jun 16 18:19 ifinfo
-rwxr-xr-x. 1 root root   2174 Jun 16 18:19 nacipmodify.sh
-rwxr-xr-x. 1 root root   1551 Jun 16 18:19 nacsetrole
-rwxr-xr-x. 1 root root   1028 Jun 16 18:19 netconfig
-rwxr-xr-x. 1 root root   1028 Jun 16 18:19 setbr
-rwxr-xr-x. 1 root root   4331 Jun 16 18:19 setifname.sh
-rwxr-xr-x. 1 root root 248936 Jun 16 18:19 ts_iot_msg
[root@localhost usrlocalbin]# 
[root@localhost usrlocalbin]# cp * /usr/local/bin/
[root@localhost home]# ll
total 12820
drwxr-xr-x. 2 root root      268 Jun 16 18:19 kernel
drwxr-xr-x. 2 root root      254 Jun 16 18:19 libs
drwxr-xr-x. 4 root root      199 Jun 16 18:19 network_toolkit
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 nginx
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 pgsql_13.6
drwxr-xr-x. 3 root root     4096 Jun 16 18:19 py
drwxr-xr-x. 2 root root       66 Jun 16 18:19 redis
drwxr-xr-x. 2 root root     4096 Jun 16 18:19 se
drwxr-xr-x. 3 root root       85 Jun 16 18:19 supervisor
-rw-r--r--. 1 root root 13109392 Jun 16 19:07 ts_iot_sams.ko
drwxr-xr-x. 2 root root      128 Jun 16 18:19 usrlocalbin
drwxr-xr-x. 5 root root       65 Jun 16 19:08 web
drwxr-xr-x. 7 root root      151 Jul  3 00:03 yihnac
[root@localhost home]# cp ts_iot_sams.ko /lib/modules/4.18.0-305.19.1.el8_4.x86_64/kernel/drivers/
[root@localhost home]# cd /lib/modules/4.18.0-305.19.1.el8_4.x86_64/kernel/drivers/
[root@localhost drivers]# depmod
[root@localhost drivers]# 

10. 开放防火墙端口
[root@localhost drivers]# firewall-cmd --zone=public --add-port={32766,80,8080,8443}/tcp --permanent
success
[root@localhost drivers]# firewall-cmd --reload
success
[root@localhost drivers]# firewall-cmd --list-port
32766/tcp 80/tcp 8080/tcp 8443/tcp
[root@localhost drivers]# 

11. 创建下载链接
[root@localhost ~]# cd /yihnac/center-web-server/media/
[root@localhost media]# mkdir apps_zip
mkdir: cannot create directory ‘apps_zip’: File exists
[root@localhost media]# ls
2021  app  apps_zip  original  sys  type  vendor
[root@localhost media]# cd /usr/share/nginx/downloadfile/media/
[root@localhost media]# cd /usr/share/nginx/downloadfile/media/
[root@localhost media]# ln -s /yihnac/center-web-server/media/apps_zip/ apps_zip
[root@localhost media]# chcon -Rt httpd_sys_content_t /usr/share/nginx/downloadfile/media/apps_zip/
[root@localhost media]# ll
total 0
lrwxrwxrwx. 1 root root 41 Jul  3 00:25 apps_zip -> /yihnac/center-web-server/media/apps_zip/
[root@localhost media]# 

//安装需要的包
[root@localhost pypackets]# pwd
/home/py/pyyl/pypackets
[root@localhost pypackets]# pip3 install kafka_python-2.0.2-py2.py3-none-any.whl 
[root@localhost pypackets]# pip3 install greenlet-1.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
[root@localhost pypackets]# pip3 install tornado-6.1-cp38-cp38-manylinux2010_x86_64.whl

//导入sql文件
[root@localhost ~]# psql -U postgres -W sams
Password: 
psql (13.6)
Type "help" for help.

sams=# i /root/tab_update.sql 

[root@localhost drivers]# insmod ts_iot_sams.ko 
[root@localhost drivers]# pwd
/lib/modules/4.18.0-305.19.1.el8_4.x86_64/kernel/drivers
[root@localhost drivers]# insmod ts_iot_sams.ko 
[root@localhost apps_zip]# supervisorctl reload
Restarted supervisord
[root@localhost apps_zip]# supervisorctl restart all
[root@localhost drivers]# lsmod | grep ts
ts_pacp              2293760  2
mptspi                 28672  2
scsi_transport_spi     40960  1 mptspi
mptscsih               45056  1 mptspi
mptbase                98304  2 mptspi,mptscsih

12. 访问web页面验证效果

本机IP+8080端口

//查看se权限命令
getsebool httpd_can_network_connect 查看是否开启
setsebool -P httpd_can_network_connect 1 开启

//替换内核命令
lsmod | grep ts
rmmod ts_pacp
insmod ts
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1005502.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号