systemd

Dockerfile构建(ssh、systemctl、nginx、tomcat、mysql)

大城市里の小女人 提交于 2020-01-03 19:27:26
一、Dockerfile Dockerfile是docker中镜像文件的的描述文件,说的直白点就是镜像文件到底是由什么东西一步步构成的。 例如:你在淘宝上买了一个衣架,但是卖家并没有给你发一个完整的衣架,而是一些组件和一张图纸,你按照这个图纸一步一步将衣架组装起来,就成了你所需要的样子。那么 Dockerfile 就是这张图纸,镜像文件就是你需要的这个衣架,Dockerfile 不建议随便命名,就用 Dockerfile。 因此,Dockerfile其内部包含了一条条的指令,每一条指令构建一层,因此每一条指令的内容,就是描述该层应当如何构建。 Docker 执行 Dockerfile 的大致流程: (1)docker从基础镜像运行一个容器; (2)执行一条指令并对容器作出修改; (3)执行类似docker commit的操作提交一个新的镜像层; (4)docker再基于刚提交的镜像运行一个新容器; (5)执行dockerfile中的下一条指令直到所有指令都执行完成。 不同阶段: 1、Dockerfile :是软件的原材料,需要定义一个Dockerfile,Dockerfile定义了进程需要的一切东西。Dockerfile涉及的内容包括执行代码或者是文件、环境变量、依赖包、运行时环境、动态链接库等等; 2、Docker镜像 :是软件的交付品,用Dockerfile定义一个文件之后

认识与使用systemctl命令

流过昼夜 提交于 2020-01-03 12:47:51
一、systemctl介绍 通常,Linux 的启动一直采用init进程。 我们经常看到 $ sudo /etc/init.d/apache2 start 或者 $ service apache2 start 这种方法有两个缺点: 一是启动时间长。init进程是串行启动,只有前一个进程启动完,才会启动下一个进程。 二是启动脚本复杂。init进程只是执行启动脚本,不管其他事情。脚本需要自己处理各种情况,这往往使得脚本变得很长。 为此,LINXU设计引入了Systemd 它的设计目标是,为系统的启动和管理提供一套完整的解决方案。根据 Linux 惯例,字母d是守护进程(daemon)的缩写。Systemd 这个名字的含义,就是它要守护整个系统。使用了 Systemd,就不需要再用init了。Systemd 取代了initd,成为系统的第一个进程(PID 等于 1),其他进程都是它的子进程。 通过上图的命令,我们可以查看Systemd版本。 总的来说,Systemd 的优点是功能强大,使用方便,缺点是体系庞大,非常复杂。事实上,现在还有很多人反对使用 Systemd,理由就是它过于复杂,与操作系统的其他部分强耦合,违反”keep simple, keep stupid”的Unix 哲学。 上图就是Systemd的架构图,看着有点吓人! 二、systemctl命令 Systemd

3.使用Kubeadm部署k8s集群

♀尐吖头ヾ 提交于 2020-01-03 03:37:07
使用Kubeadm部署k8s集群 kubeadm 是一个提供了 kubeadm init 和 kubeadm join 最佳实践命令,且用于快速构建一个 kubernetes 集群的工具,你可以使用此工具快速构建一个 kubernetes 学习环境。 通过本章节的学习,你将能够使用 kubeadm 工具,成功构建出一个基础的 kubernetes 集群环境 环境准备 Hosts文件准备 Docker环境配置 其他准备工作 使用Kubeadm部署k8s集群 参考文档 备注 1.环境准备 ip 主机名 角色 操作系统 192.168.0.104 centos-1.shared master Master Centos6.4 192.168.0.108 centos-2.shared node01 Node Centos6.4 192.168.0.109 centos-3.shared node01 Node Centos6.4 2.Hosts文件准备 192.168.0.104 centos-1.shared master 192.168.0.108 centos-2.shared node01 192.168.0.109 centos-3.shared node02 3.Docker环境配置 关闭系统默认防火墙和 SELINUX setenforce 0 sed -i -r "/

Inconsistent systemd startup of freeswitch

纵饮孤独 提交于 2020-01-03 01:52:32
问题 I have two problems running freeswitch from systemd : EDIT 2 - I have moved the slow start up question to here (Freeswitch pauses on check_ip at boot on centos 7.1) as although they may be related it's probably good as a standalone. EDIT - I have noticed something else. Look at these next lines captured from the terminal output when running it from there. The gap is 4 minutes but it has been around 10 minutes before. I noticed it because I was trying to find out why port 8021 was taking

Inconsistent systemd startup of freeswitch

橙三吉。 提交于 2020-01-03 01:52:09
问题 I have two problems running freeswitch from systemd : EDIT 2 - I have moved the slow start up question to here (Freeswitch pauses on check_ip at boot on centos 7.1) as although they may be related it's probably good as a standalone. EDIT - I have noticed something else. Look at these next lines captured from the terminal output when running it from there. The gap is 4 minutes but it has been around 10 minutes before. I noticed it because I was trying to find out why port 8021 was taking

编译安装LNMP

对着背影说爱祢 提交于 2020-01-01 23:38:32
软件:MySQL-5.7.2、PHP-7.1.5、Nginx-1.14.2 安装mysql: 卸载系统自身mariadb: [root@localhost ~]# rpm -qa |grep mariadb mariadb-libs-5.5.64-1.el7.x86_64 [root@localhost ~]# rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps 安装依赖包: [root@localhost ~]# yum -y install make gcc-c++ cmake bison-devel ncurses-devel perl-Data-Dumper boost boost-doc boost-devel 创建源码目录: [root@localhost ~]# mkdir /home/tools && cd /home/tools 解压源码包: [root@localhost tools]# mv /root/mysql-boost-5.7.22.tar.gz . [root@localhost tools]# ll total 47840 -rw-r--r--. 1 root root 48985783 Jan 1 02:12 mysql-boost-5.7.22.tar.gz [root@localhost

Wait for mongodb to be ready before starting pm2 process on reboot

不羁的心 提交于 2020-01-01 16:39:10
问题 I am having trouble making pm2 wait for mongodb to be ready before it starts a process on system reboot. (I am using Ubuntu 16.04 server) In my systemd service file for pm2 I have this, which I thought would make it wait until after mongodb was started: [Unit] Description=PM2 process manager Documentation=https://pm2.keymetrics.io/ Wants=mongod.service After=network.target mongod.service [Service] Type=forking But it seems that it runs pm2, and therefore the node.js processes that pm2

Can I import a Golang package based on the OS I'm building for?

你。 提交于 2020-01-01 16:08:09
问题 Say I have a go project that based on which OS, and in some cases which distro, I want to use say a Systemd client package vs an Upstart client package vs a sysv client package vs a launchd client package. Is it possible to selectively import each package so I only import the one I need per OS/distro I'm building for? Or do I have to import each package for each OS/distro? 回答1: Package build Build Constraints A build constraint, also known as a build tag, is a line comment that begins //

Can I import a Golang package based on the OS I'm building for?

会有一股神秘感。 提交于 2020-01-01 16:07:07
问题 Say I have a go project that based on which OS, and in some cases which distro, I want to use say a Systemd client package vs an Upstart client package vs a sysv client package vs a launchd client package. Is it possible to selectively import each package so I only import the one I need per OS/distro I'm building for? Or do I have to import each package for each OS/distro? 回答1: Package build Build Constraints A build constraint, also known as a build tag, is a line comment that begins //

Launching Linux from Busybox (pivot_root or switch_root, or ? )

江枫思渺然 提交于 2020-01-01 10:17:22
问题 On a beaglebone hardware, I want to start on a partition with a minimalist busybox system (/dev/mmcblk0p2), run some checks on the 2 other partitions (/dev/mmcblk0p5 & /dev/mmcblk0p6) containing more complete Linux systems (Angström), then start on one or the other of the 2 Linux systems based on those tests. The problem is that I cannot find how to start another system correctly from busybox. What I did: From the (perfectly working) busybox system: export PATH=/bin:/sbin:/usr/bin:/usr/sbin