sudo

Celery详解(1)

妖精的绣舞 提交于 2019-12-19 12:51:20
在学习Celery之前,我先简单的去了解了一下什么是生产者消费者模式。 生产者消费者模式 在实际的软件开发过程中,经常会碰到如下场景:某个模块负责产生数据,这些数据由另一个模块来负责处理(此处的模块是广义的,可以是类、函数、线程、进程等)。产生数据的模块,就形象地称为生产者;而处理数据的模块,就称为消费者。 单单抽象出生产者和消费者,还够不上是生产者消费者模式。该模式还需要有一个缓冲区处于生产者和消费者之间,作为一个中介。生产者把数据放入缓冲区,而消费者从缓冲区取出数据,如下图所示: 生产者消费者模式是通过一个容器来解决生产者和消费者的强耦合问题。生产者和消费者彼此之间不直接通讯,而通过消息队列(缓冲区)来进行通讯,所以生产者生产完数据之后不用等待消费者处理,直接扔给消息队列,消费者不找生产者要数据,而是直接从消息队列里取,消息队列就相当于一个缓冲区,平衡了生产者和消费者的处理能力。这个消息队列就是用来给生产者和消费者解耦的。------------->这里又有一个问题,什么叫做解耦? 解耦 :假设生产者和消费者分别是两个类。如果让生产者直接调用消费者的某个方法,那么生产者对于消费者就会产生依赖(也就是耦合)。将来如果消费者的代码发生变化,可能会影响到生产者。而如果两者都依赖于某个缓冲区,两者之间不直接依赖,耦合也就相应降低了。生产者直接调用消费者的某个方法,还有另一个弊端

编译Linux内核

[亡魂溺海] 提交于 2019-12-19 12:24:08
1、在 http://www.kernel.org/ 上下载内核源代码linux-2.6.32.60.tar.xz,放在/usr/src目录下。 2、进入Linux内核源码所在的目录(cd /usr/src),解压该内核代码到/usr/src/linux-2.6.32.60下: xz -d linux-2.6.32.60.tar.xz tar -xvf linux-2.6.32.60.tar 执行第一条命令式可能会提示找不到xz命令,这时可以输入apt-get install xz-***(后面的不记得了,呵呵)安装xz文件解析程序 3、进入Linux内核源码解压后的目录/usr/src/linux-2.6.32.60(cd /usr/src/linux-2.6.32.60) 4、sudo make mrproper 净化解压后的源代码 5、sudo make menuconfig 对内核选项进行配置 在配置过程中会发生如下错误: *** Unable to find the ncurses libraries or the *** required header files. *** 'make menuconfig' requires the ncurses libraries. *** *** Install ncurses (ncurses-devel) and try

Ubuntu 字体设置:使用Windows 字体

强颜欢笑 提交于 2019-12-19 11:58:31
基础知识 Sans-serif=无衬线体=黑体:并不是具体一款字体,而是一类字体,选择它其实等于选择这类字体中优先级最高的那款字体。 Serif=衬线体=白体:同上 Monospace=等宽字体,意思是字符宽度相同:同上 点阵字体=位图字体 无衬线体更适合电脑屏幕阅读,衬线体适合打印。——因为衬线可以使得人视线平齐于一行。也就是说不会读破行。 中文显示时有不同的方式,一方面因为中文本身拥有的横和同高度就可以导致这种平齐。行距对中文更重要。 1. 安装字体 sudo apt-get install ttf-mscorefonts-installer #微软字体 sudo apt-get install xfonts-wqy #文泉驿-点阵宋体 cd ~ wget http://www.stchman.com/tools/MS_fonts/tahoma.zip #Tahoma 字体 sudo unzip -d /usr/share/fonts/truetype/msttcorefonts ~/tahoma.zip sudo fc-cache -f -v rm -f ~/tahoma.zip fc-cache -f -s -v #刷新字体缓存 2. 进入 “Advanced settings" 设置(如果没有安装,执行 sudo apt-get install gnome-tweak

ansible

喜夏-厌秋 提交于 2019-12-19 09:55:46
安装ansible: AnbleVersion2.4及更高版本可以管理包含Python2.6或更高版本的早期操作系统。 y um方式安装: yum源或rpm包来源: 埃佩尔 以及 Relases.ansible.com . $ sudo yum install ansible 您也可以自己构建一个可以分发和安装的RPM。 $ git clone https://github.com/ansible/ansible.git $ cd ./ansible $ make rpm $ sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm 托管节点的需求 在托管节点上,需要ssh。默认情况下使用sftp。如果sftp不可用,可以在 ansible.cfg切换到scp 。您还需要Python 2(版本2.6或更高版本)或Python 3(版本3.5或更高版本)。 注 如果在远程节点上启用了SELinux,需要安装 libselinux-python。 yum install libselinux-python 默认情况下,Ansible使用位于 /usr/bin/python的解释器 。如果是 python2/3 您可能会看到以下错误: "module_stdout": "/bin/sh: /usr/bin/python: No such file or

Ubuntu16下配置支持Windows访问的samba共享

丶灬走出姿态 提交于 2019-12-19 08:30:18
一、安装Ubuntu samba服务器 $ sudo apt-get install samba $ sudo apt-get install smbclient # Linux客户端测试用 二、创建samba配置文件 1. 备份原配置文件 $ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 2. 创建共享目录 $ sudo mkdir -p /home/share 一般来说,该目录的权限为755,将其改为777之后,Owner之外的其他用户才有权限写入。 $ sudo chmod 777 /home/share 3. 修改配置文件 $ sudo vim /etc/samba/smb.conf 在smb.conf最后添加: [share] path = /home/share browseable = yes writable = yes comment = smb share test 另外,总结一下常见的samba配置及说明: [share] # 该共享的共享名 comment = smb share test # 该共享的备注 path = /home/share # 共享路径 allow hosts = host(subnet) # 设置该Samba服务器允许的工作组或者域 deny hosts = host

增加samba用户提示Failed to add entry for user

孤者浪人 提交于 2019-12-19 08:29:58
1、首先在Ubuntu安装好samba,具体步骤为: 安装samba:sudo apt-get install samba 安装smbclient:sudo apt-get install 安装smbfs:sudo apt-get smbfs 2、修改配置文件 sudo gedit /etc/samba/smb.conf 编辑smb.conf 文件 将;security user修改为 security user,然后在配置文件末尾添加 [ShareFiles] comment = Shared Folder require password path = /home/magic/share public = yes writable = yes valid users = magic create mask = 0777 directory mask = 0777 force user = nobody force group = nogroup available = yes browseable = yes 保存后重新启动samba,sudo /etc/init.d/samba restart 3、设置用户和密码 sudo smbpasswd -a magic 接着俺提示输入密码。 4、最后windows下网上邻居->右键->映射网络驱动器 输入 文件夹框 \\ip地址

在Ubuntu16.04下搭建samba,实现linux与windows之间的资源共享

可紊 提交于 2019-12-19 08:29:25
转载于http://www.linuxdiyf.com/linux/24260.html 1、开始需要我们做的是先在我们的ubuntu下安装好samba: 安装samba:sudo apt-get install samba 安装smbclient:sudo apt-get install smbclient 2、修改配置文件 vi /etc/samba/smb.conf 编辑smb.conf 文件 在配置文件的最末尾加上: [share] comment = Shared Folder require password path = /home/share public = yes writable = yes valid users = share create mask = 0777 directory mask = 0777 force user = nobody force group = nogroup available = yes browseable = yes 保存后重新启动samba:sudo /etc/init.d/samba restart 3、设置用户和密码 sudo smbpasswd -a share 接着俺提示输入密码。(前提是添加了此用户:useradd share) 否则系统在没有此用户的前提下按默认操作是会报如下错的:

从零开始学MySQL(一)

扶醉桌前 提交于 2019-12-19 05:33:18
如果您浏览过许多IT类的招聘职位,那么掌握数据库技能的重要性便不言自明了。因JAVA常常与MySQL所挂钩,因此兴起了写博客记载学习的念头,盼与君共勉。 然,在进行MySQL语法的学习之前,我们无不面临环境如何部署的问题,而这个问题又常常令新手望而生畏。在接下来篇幅中,我们将一起合作,消灭这只“拦路虎”。 本文的规则: 黑色字体 为正常步骤, 红色字体 为希望能引起读者的注意,笔者用意大致是出于“警示”或“引导”这两种。 本文阅读建议:应先看完所有步骤,才能关注到应该注意的点。这样会使接下来的安装更为顺利,在安装步骤的理解上也能有所增进。 本文概览: (一) 安装MySQL 5.17 (二) 操控MySQL服务 (三) 接下来应当做些什么 若本文出现错误或有所遗漏等问题,还请读者指出,鄙人不胜感激。 (一)安装MySQL 5.17 (0) 鉴于Windows下的安装尤为容易,这里便不再赘述。如果您对于将MySQL安装到Windows有些许不确定或是困难,还请移步必应或百度搜索一下。对此造成不便,还请海涵。 (1)Ubuntu 16.04 ① 首先,使用Ctrl + Alt + T或点击鼠标右键选择Open Terminal, 打开命令行(CLI)界面 ; ② 其次,需要 先更新当前软件源 (这是 一个“用于获取可安装的包信息,以及会列出当前已安装了的、且有可更新资源” 的步骤)

Why using curl | sudo sh is not advised?

本小妞迷上赌 提交于 2019-12-19 05:29:50
问题 While I was reading the introduction to the Rust programming language, I came across the installation method which asks to use the following command curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh with a note of caution that this is not the most trusted way of installing an application. Can anybody provide me the details about how this command can be dangerous and are there any methods to protect yourself from its effects? 回答1: Because you are giving root access to whatever

sudo: effective uid is not 0, is sudo installed setuid root?

放肆的年华 提交于 2019-12-19 05:01:49
问题 I am trying to create deb package from LXC rootfs, and after creating it I want to install that package any computer. Up to this point I achieved packaging and installing deb package, however after installation of LXC package, I cannot be superuser in that lxc. I get this error when I use "sudo" command. sudo: effective uid is not 0, is sudo installed setuid root? thanks in advance. 回答1: I just had this same exact problem on Mac OS after strangely deciding to screw my own system by doing: