运维随笔

笔记


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 搜索

npm私库部署-cnpmjs

发表于 2018-08-16 | 更新于: 2022-03-31 | 分类于 Linux
字数统计: 2.9k | 阅读时长 ≈ 13

一、部署cnpm

阅读全文 »

centos同步yum源到本地

发表于 2018-08-16 | 更新于: 2022-06-05 | 分类于 Linux
字数统计: 218 | 阅读时长 ≈ 1

一、环境

os:centos 7.3 1611

应用:yum-utils

互联网源:阿里云

二、步骤

删除/etc/yum.repos.d下所有源文件

1、下载源repo到本地

1
$ wget -O /etc/yum.repos.d/aliyun.repo https://mirrors.aliyun.com/repo/Centos-7.repo

2、安装yum-utils提供reporsync服务

1
$ yum install yum-utils -y

3、查看yum源仓库标识

1
2
3
4
5
6
7
8
9
10
11
[root@localhost yum.repos.d]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,591
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 196
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 657
repolist: 10,444

4、根据源标识同步源到本地目录

1
[root@localhost ~]# reposync -r base -p /var/www/html/     #这里同步base目录到本地

注意: 部分互联网yum源不支持同步

参考资料
http://www.cnblogs.com/chengd/articles/6912938.html

https://www.2cto.com/net/201512/455901.html

Centos7安装独立显卡驱动

发表于 2018-08-16 | 更新于: 2022-06-05 | 分类于 Linux
字数统计: 1.6k | 阅读时长 ≈ 8

1 Centos7 安装独立显卡驱动

1.1 参考:

https://blog.csdn.net/u013378306/article/details/69229919

1.2 安装基础依赖环境

1
$ Yum install gcc kernel-delve -y

注意事项,保证内核版本和源码版本一样,否则,安装报错误6:

查看内核版本:

1
$ ls /boot | grep vmlinu

查看源码包版本

1
rpm -aq | grep kernel-devel

从上面的输出中可以看出内核版本号和内核源码版本。为了解决这个错误,需要从FC官方网站上下载与内核版本对应的源码包进行安装。
可以在以下网站下载并安装:
http://rpmfind.net/linux/rpm2html/search.php?query=kernel-devel

1.3 源码安装

1.3.1 在英伟达官网下载相应驱动

搜索出相应的驱动后,不要直接点,而是右健,Save Link as…

否则,会出现下载半天没动静的情况。

存放的路径上最好不要有中文。

我存放的路径是 ~/Downloads/NVIDIA-Linux-x86_64-346.47.run

1.3.2 屏蔽默认带有的nouveau

使用su命令切换到root用户下: su root

打开/lib/modprobe.d/dist-blacklist.conf

1
2
3
4
5
# 将nvidiafb注释掉。
# blacklist nvidiafb
然后添加以下语句:
blacklist nouveau
options nouveau modeset=0

1.3.3 重建initramfs image步骤

1
2
$ mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
$ dracut /boot/initramfs-$(uname -r).img $(uname -r)

1.3.4 修改运行级别为文本模式

1
$ systemctl set-default multi-user.target

1.3.5 重新启动, 使用root用户登陆

1
$ reboot

1.3.6 查看nouveau是否已经禁用

1
ls mod | grep nouveau

如果没有显示相关的内容,说明已禁用。

1.3.7 进入下载的驱动所在目录

1
2
3
$ chmod +x NVIDIA-Linux-x86_64-346.47.run

$ ./NVIDIA-Linux-x86_64-346.47.run

安装过程中,选择accept

如果提示要修改xorg.conf,选择yes

1.3.8 修改运行级别回图形模式

1
systemctl set-default graphical.target

1.3.9 重新启动,OK

在Applications–Other可以看见NVIDIA X Server Settings菜单。

1.4 问题:

错误1:

1
ERROR: The Nouveau kernel driver is currently in use by your system.  This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding.  Please consult the NVIDIA driver README and your Linux distribution's documentation for details on how         to correctly disable the Nouveau kernel driver.

解释:如果没有执行屏蔽nouveau操作,报以上错误。

错误2:

1
unable to find the development too 'cc' in you path; please make sure that you have the package 'gcc

解决办法:

1
$ yum install gcc

错误3:

1
2
3
ERROR: Unable to find the kernel source tree for the currently running kernel.  Please make sure you have installed the kernel source files for your

kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM installed. If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.

解决办法:

1
$ yum install kernel-delve

错误5:

1
ERROR: Unable to find the kernel source tree for the currently running kernel.  Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the         'kernel-source' or 'kernel-devel' RPM installed.  If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.

解决方法:

1
$ ./NVIDIA-Linux-x86_64-390.67.run --kernel-source-path=/usr/src/kernels/3.10.0-862.3.2.el7.x86_64/

错误6:

1
ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if another driver, such as nouveau, is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA GPU(s), or no NVIDIA GPU installed in this system is supported by this NVIDIA Linux graphics driver release.
Please see the log entries 'Kernel module load error' and 'Kernel messages' at the end of the file '/var/log/nvidia-installer.log' for more information.

解决办法:

可以通过以下方式查看内核版本和源码包版本:
ls /boot | grep vmlinuz
如果上面的命令输出中有多个内核,则按grub.conf中指定的文件为准。
rpm -aq | grep kernel-devel
kernel-devel-2.6.35.13-92.fc14.i686
从上面的输出中可以看出内核版本号和内核源码版本。为了解决这个错误,需要从FC官方网站上下载与内核版本对应的源码包进行安装。
可以在以下网站下载并安装:
http://rpmfind.net/linux/rpm2html/search.php?query=kernel-devel

备注:执行更新内核操作好需要重新执行屏蔽nouveau,及重建initramfs image步骤。

警告:

1
2
3
4
5
6
**


WARNING: nvidia-installer was forced to guess the X library path '/usr/lib64' and X module path '/usr/lib64/xorg/modules'; these paths were not queryable from the system. If X fails to find the NVIDIA X driver module, please install the `pkg-config` utility and the

X.Org SDK/development package for your distribution and reinstall the driver.

字符模式安装警告信息,可忽略。

2 安装cuda

参考:https://blog.csdn.net/claroja/article/details/81034147

错误:

1
2
3
Installing the CUDA Toolkit in /usr/local/cuda-6.5 ...
Missing recommended library: libGLU.so
Missing recommended library: libXmu.so

解决:安装第三方软件

1
2
3
$ yum install freeglut-devel libX11-devel libXi-devel libXmu-devel  \

$ make mesa-libGLU-devel

2.1 测试CUDA

1
2
3
4
5
6
7
[root@fengyun6 ~]# find / -name deviceQuery

/root/NVIDIA_CUDA-9.0_Samples/1_Utilities/deviceQuery

/usr/local/cuda-9.0/extras/demo_suite/deviceQuery

/usr/local/cuda-9.0/samples/1_Utilities/deviceQuery

若出现以下信息,则表示安装成功

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
[root@fengyun6 ~]# /usr/local/cuda-9.0/extras/demo_suite/deviceQuery

/usr/local/cuda-9.0/extras/demo_suite/deviceQuery Starting...



CUDA Device Query (Runtime API) version (CUDART static linking)



Detected 1 CUDA Capable device(s)



Device 0: "GeForce GTX 1080 Ti"

CUDA Driver Version / Runtime Version 9.1 / 9.0

CUDA Capability Major/Minor version number: 6.1

Total amount of global memory: 11178 MBytes (11721113600 bytes)

(28) Multiprocessors, (128) CUDA Cores/MP: 3584 CUDA Cores

GPU Max Clock rate: 1645 MHz (1.64 GHz)

Memory Clock rate: 5505 Mhz

Memory Bus Width: 352-bit

L2 Cache Size: 2883584 bytes

Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)

Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers

Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers

Total amount of constant memory: 65536 bytes

Total amount of shared memory per block: 49152 bytes

Total number of registers available per block: 65536

Warp size: 32

Maximum number of threads per multiprocessor: 2048

Maximum number of threads per block: 1024

Max dimension size of a thread block (x,y,z): (1024, 1024, 64)

Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)

Maximum memory pitch: 2147483647 bytes

Texture alignment: 512 bytes

Concurrent copy and kernel execution: Yes with 2 copy engine(s)

Run time limit on kernels: No

Integrated GPU sharing Host Memory: No

Support host page-locked memory mapping: Yes

Alignment requirement for Surfaces: Yes

Device has ECC support: Disabled

Device supports Unified Addressing (UVA): Yes

Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0

Compute Mode:

< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >



deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.0, NumDevs = 1, Device0 = GeForce GT

X 1080 TiResult = PASS

安装cudnn
参考:https://www.cnblogs.com/mar-q/p/7482720.html

下载:https://developer.nvidia.com/rdp/cudnn-archive

3 安装cudnn

1
$ tar -xvf cudnn-8.0-linux-x64-v6.0.tgz -C /usr/local/

jenkins各种触发方式介绍

发表于 2018-08-16 | 更新于: 2022-06-05 | 分类于 自动化运维
字数统计: 175 | 阅读时长 ≈ 1

触发远程构建

使用svn存储库hooks的post-commit,调用jenkins的api触发job。(存储库更新即触发构建,不能针对某个分支目录更新触发)

Build after other projects are built
某个projects触发构建后执行构建

Build periodically
Build periodically:周期进行项目构建(它不care源码是否发生变化),我的配置如下:

0 2 * (每天2:00 必须build一次源码)

Poll SCM
Poll SCM:定时检查源码变更(根据SCM软件的版本号),如果有更新就checkout最新code下来,然后执行构建动作。我的配置如下:

/5 * (每5分钟检查一次源码变化)可针对某个分支目录更新触发构建

Nginx反向代理报504超时错误

发表于 2018-08-16 | 更新于: 2022-06-05 | 分类于 Linux
字数统计: 505 | 阅读时长 ≈ 2

一、nginx+tomcat

后端为tomcat,nginx代理报504超时错误。

问题描述:

#错误

1
2
1.198.17.123 - - [06/Jul/2018:01:48:57 +0000] "POST /mapbj3/getticket HTTP/1.1" 504 537 "https://XXXXXXXXXX.com/walkcode3/index.html?openId=oB6UW0cF3Z_dnYXnz4tG4OFt7Rt0" "Mozilla/5.0 (Linux; Android 8.1; PACM00 Build/O11019; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.143 Crosswalk/24.53.595.0 XWEB/155 MMWEBSDK/19 Mobile Safari/537.36 MicroMessenger/6.6.6.1300(0x26060638) NetType/WIFI Language/zh_CN MicroMessenger/6.6.6.1300(0x26060638) NetType/WIFI Language/zh_CN miniProgram" "-"
2018/07/06 01:48:57 [error] 6#6: *2573 upstream timed out (110: Connection timed out) while connecting to upstream, client: 1.198.17.123, server: , request: "POST /mapbj3/getticket HTTP/1.1", upstream: "http://123.149.236.180:8022/mapbj3//getticket", host: "XXXXXXXX.com", referrer: "https://XXXXXXX.com/walkcode3/index.html?openId=oB6UW0cF3Z_dnYXnz4tG4OFt7Rt0"

1、项目本地访问没问题,通过nginx访问报504错误;

2、重启nginx后正常,反复发生,其它项目代理没有问题;

3、搜索了一大推”NGINX 504 Gateway Time-out tomcat”,都是与php有关的,而默认优化的就是php配置的;

问题处理:
修改/etc/nginx/nginx.conf,添加如下信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# cat /etc/nginx/nginx.conf
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
    #用于tomcat反向代理,解决nginx 504错误 
    proxy_connect_timeout   300; 
    proxy_send_timeout      300; 
    proxy_read_timeout      300; 
    proxy_buffer_size       16k; 
    proxy_buffers           4 64k; 
    proxy_busy_buffers_size 128k; 
    proxy_temp_file_write_size 128k;
    # ps:以timeout结尾配置项时间要配置大点
}

二、nginx+php(未验证)

问题如上,问题处理添加如下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
    #用于php反向代理,解决nginx 504错误 
    #以fastcgi_*配置项是php用的    
    fastcgi_connect_timeout 1000;
    fastcgi_send_timeout 1000;
    fastcgi_read_timeout 1000;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 8 128k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;
    fastcgi_intercept_errors on;
}

参考文档

https://blog.csdn.net/lcj_star/article/details/76672748https://www.iyunv.com/thread-319236-1-1.html

1…29303132
OperationMAN

OperationMAN

日常运维文档整理。

157 日志
9 分类
107 标签
E-Mail GitHub 码云 Linux命令大全 鸟哥的私房菜 RUNOOB.com 陈沙克日志 Bitnami Font Awesome
友情链接
  • Next优化
  • Next深度优化
© 2023 OperationMAN | 豫ICP备 17032296 号