/avatar.png

Mr.

在Docker中启动一个centos系统+代理+python

在Docker中启动一个centos系统+代理+python 过程记录 通过compose文件启动容器 运行位于附件中的linux-compose.yml文件 注意其中的卷映射规则,根据自己实际情况进行修改 1 docker-compose -f linux-compose.yml up -d 进入容器运行install.sh脚本,该脚本会为你自动更新软件包并设置root账户的密码为123456 1 2 3 docker exec -it <容器名> /bin/bash cd / ./install.sh 设置代理 如果有需要,可以为系统设置代理 1 2 3 4 # 设置http代理 export http_proxy=http://<ip>:<port> # 设置https代理 export https_proxy=http://<ip>:<port> 取消代理 1 2 3 4 unset http_proxy unset https_proxy # 可进行查看是否取消成功 echo $http_proxy 附件 三个文件

在parallel中为centos虚拟机分配固定ip

查看网卡 1 2 3 ifconfig # 或者 # ip addr 配置网卡文件 这里以修改网卡eth0为例 1 cd /etc/sysconfig/network-scripts/ 如果有对应的网卡配置文件 则打开对应的配置文件 1 vim ifcfg-eth0 分别做出更新和新增配置操作,其中新增配置内容从Parallel虚拟机-->设置-->网络-->高级-->打开网络首选项-->Shared查看。 1 2 3 4 5 6 7 8 # 更新 BOOTPROTO=static ONBOOT=yes # 新增 IADDR=10.211.55.100 # 你要分配的固定ip GATEWAY=10.211.55.1 # 网关地址 NETMASK=255.255.255.0 # 子网掩码 DNS1=10.211.55.1 # 域名解析器地址 如果没有对应的网卡配置文件 随便复制一份网卡配置文件并命名为你需要的网卡名 1 2 # 这里以网卡eth0为例 cp ifcfg-enp0s5 ifcfg-eth0 查询网卡UUID信息,记下UUID值

碎片笔记

修改centos的主机名 1 vim /etc/hostname 修改centos主机名映射hosts文件 1 vim /etc/hosts 常用端口号 hadoop3.x HDFS NameNode 内部通常端口: 8020 / 9000 / 9820 HDFS NameNode 对用户的查询端口: 9870 Yarn查看任务运行情况端口: 8088 历史服务器: 19888 hadoop2.x HDFS NameNode 内部通常端口: 8020 / 9000 HDFS NameNode 对用户的查询端口: 50070 Yarn查看任务运行情况端口: 8088 历史服务器: 19888 常用配置文件 hadoop3.x core-site.xml hdfs-site.xml yarn-site.xml mapred-site.xml workers hadoop2.x core-site.xml hdfs-site.xml yarn-site.xml mapred-site.xml slaves

nginx笔记

通过docker启动nginx见docker笔记 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 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 #user nobody; worker_processes 1; #error_log logs/error.

linux使用技巧

查看日志 1 2 3 4 5 6 # 查看动态日志 tail -F 文件名字 # 查看文件 cat 文件 # 查找文件中的名字 find -name 路径 查看服务 1 2 3 4 5 # 查看端口进程 # 端口(eg:8080) netstat -nltp|grep 端口号 # 进程(eg:java) ps -aux|grep 进程名 常用命令 查看当前目录下的所有文件:LL 复制:CP 移动:MV 删除:Rf 查看历史用过的命令:history 拷贝目录 1 2 3 4 5 6 7 # 命令 cp -r 目录名称 目录拷贝的目标位置 # -r代表递归 # 示例 # 将/usr/tmp目录下的aaa目录复制到/usr目录下面 cp -r /usr/temp/aaa /usr # 注意 # cp命令不仅可以拷贝目录,还可以拷贝文件、压缩包等,拷贝文件和压缩包时不用写-r递归 搜索目录【查】find 1 2 3 4 5 # 命令 find 目录 参数 文件名称 # 示例 # 查找/usr/temp目录下的所有以a开头的目录或文件 find /usrtemp -name 'a*' 创建文件 1 2 3 4 5 # 命令 touch 文件名 # 示例 # 在当前目录创建一个名为aa.