sudo

sudo open -e ~/.bash_profile Permission denied mac

孤者浪人 提交于 2019-12-20 10:54:10
问题 I am trying to edit bash_profile file to add path to my sdk through the following command on my mac machine. sudo touch ~/.bash_profile; open -e ~/.bash_profile It opens the file in TextEdit but does not allow me to edit it. Though i have given super-user permission and password while running the above command. It is giving me following message when i try to edit it. "You don’t own the file “.bash_profile” and don’t have permission to write to it. You can duplicate this document and edit the

How to use sudo inside of a Run Script build phase in Xcode 4?

戏子无情 提交于 2019-12-20 10:29:53
问题 I need use execute a command inside of a script in a Run Script build phase in Xcode 4 using sudo. However, the compiler complains: sudo: no tty present and no askpass program specified Anyone have a clever solution for this problem? 回答1: One solution is to place the sudo password in an executable shell script like the following: #!/bin/bash echo thesudopassword This shell script might be called password.sh Then, setup the environment variable SUDO_ASKPASS=password.sh Once this is setup, the

Mac 安装redis

谁都会走 提交于 2019-12-20 10:21:52
一.下载安装 1. 官网 http://redis.io/ 下载最新的稳定版本,这里是3.2.0 2. sudu mv 到 /usr/local/ 3. sudo tar -zxf redis-3.2.0.tar 解压文件 4. 进入解压后的目录 cd redis-3.2.0 5. sudo make test 测试编译 6. sudo make install 安装成功! 二. 服务配置 切换到root用户 1. /usr/local 建立相关目录 sudo mkdir /usr/local/redis/bin sudo mkdir /usr/local/redis/etc sudo mkdir /usr/local/redis/db 2. 拷贝/usr/local 下的 bin 目录到 /usr/local/redis/bin sudo cp /usr/local/bin /usr/local/redis/bin 3. 拷贝/usr/local/redis/redis-3.2.0/src 下的 mkreleasehdr.sh 到 /usr/local/redis/bin下 sudo cp /usr/local/redis3.2.0/src /mkreleasehdr.sh /usr/local/redis/mkreleasehdr.sh 4. 拷贝 redis.conf 到

在ubuntu中安装Jenkins

穿精又带淫゛_ 提交于 2019-12-20 10:11:45
安装前的准备 一台 ubuntu 主机(本篇文章使用的是Ubuntu 16.04.5 LTS) 切换到root用户 安装 Jenkins 第一次安装的可以稍微看下 jenkins 的安装文档 总之,如果没有安装 Java 需要安装一下。 下面是目前找到的在 ubuntu 下安装 Java 最简单的方法 Java 安装 参考: https://www.cnblogs.com/orzs/p/11168693.html 1 sudo add-apt-repository ppa:openjdk-r/ppa# 需要回车一下 2 sudo apt-get update 3 echo y|sudo apt-get install openjdk-8-jdk Jenkins的安装 1 wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - 2 sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' 3 sudo apt-get update 4 echo y|sudo apt-get install jenkins

ubuntu服务器网络管理(解决无法restart命令重启网卡,网卡冲突等)

我们两清 提交于 2019-12-20 10:08:26
在我们使用服务器的网络过程中,服务器都有多个网卡,通常需要给服务器多个IP以此来配合多个网络的使用,但是很多时候给网卡新配置一个IP之后都不会生效,下面给出两种方法 查看网卡名 ifconfig -a 这个命令可以打印出现有的所有网卡的名称,如图: 查看网卡配置详细参数 sudo ethtool eth0 修改网卡配置文件 sudo vi /etc/network/interfaces auto eth0 iface eth0 inet static address 192 . 168 . 1 . 125 netmask 255 . 255 . 255 . 0 network 192 . 168 . 1 . 0 broadcast 192 . 168 . 1 . 255 gateway 192 . 168 . 1 . 1 #此位置为网关,只能给一个网卡配置 # dns-* options are implemented by the resolvconf package, if installed dns - nameservers 114 . 114 . 114 . 114 auto eth1 iface eth1 inet static address 192 . 168 . 2 . 125 netmask 255 . 255 . 255 . 0 network 192 .

Getting sudo and nohup to work together

若如初见. 提交于 2019-12-20 09:47:52
问题 Linux newbie here. I have a perl script which takes two command line inputs. I tried to run it in the background but this is what I got: [~user]$ nohup sudo ./ascii_loader_script.pl 20070502 ctm_20070502.csv & [2] 19603 [~user]$ nohup: appending output to `nohup.out' after the system returns "nohup: appending output to `nohup.out'", no new prompt will appear. Then as long as I type in some other command, the shell will tell me that the process is stopped: [~user]$ nohup sudo ./ascii_loader

Setting up process.env variables using EXPORT while running node with sudo

落爺英雄遲暮 提交于 2019-12-20 09:35:47
问题 I'm using node.js on EC2 I type EXPORT PORT=80 in terminal, and i see that it correctly saves it when i type EXPORT But when I run my node.js app with the following: ... console.log(process.env); ... PORT is not listed in the object when I'm running it with sudo: sudo node app.js How do I set PORT so that I can access it from the process.env object while running node with sudo? 回答1: To set process.env variable use the following code: sudo PORT=80 node server.js Of course, you can set multiple

Rabbit安装(单机及集群,阿里云)

情到浓时终转凉″ 提交于 2019-12-20 06:51:31
Rabbit安装(单机及集群,阿里云) 前言 虽然我并不是部署人员,但是自己私人测试环境的各类东东还是得自己安装的。 尤其在规模不大的公司,基本安装部署工作都是后端的份内之事。 那么最令人痛苦的,莫过于自己就是安装大佬教程走,但是就是过不去。尤其是初学者,解决问题的能力,还不足,往往就直接卡死了。 其实还有另外一个问题,那就是很多的教程,包括许多视频的教学,大多采用不真实的环境。要么是多台虚拟机实现集群,要么是一台线上服务器走天下。当然作者们也有着诸多考虑,有的是为了学员可以零成本的感受安装,另一方面学员大多都是学习知识,而不是为了实际应用(真的懂得,又不大需要这个东东)。最重要的是,学习阶段,大部分安装都是单机的,可以满足需求了。 但是,我发现在很多的扣扣群,微信群依然存在着那么一批正式环境安装遇到各类问题,苦求无门的朋友。在我回复之后,部分人提议我可以将这部分经验发出来,帮助更多的人。 所以有了这个系列,我会通过真实的阿里服务器集群(三台),搭建各个中间件的集群等。 最后,由于打马赛克太麻烦了。并且我之后可能会开放安装视频,所以有的IP什么的,我并不方便打马赛克。但是希望你们不要做坏事儿哈。 Rabbit安装概述 简介 RabbitMQ是一款消息中间件,其安装分为: 单机安装(只有一台服务器,上面只有一个RabbitMQ的Broker实例) 多主集群转发数据

LINUX操作系统VIM的安装和配置

怎甘沉沦 提交于 2019-12-20 05:06:27
VIM的安装 在命令行敲入“vi”后按"tab"键,可以看到目前系统中只安装了vi和vim.tiny。 vim是从VI发展而来的一个文本编辑器,功能更强大。而vim.tiny是vim的精简版,所以,安装vim势在必行。 ubuntu系统: 普通用户下输入命令:sudo apt-get install vim-gtk centos系统: 普通用户下输入命令:yum -y install vim* 图片以ubuntu为例 这里,输入“y”后,回车。 之后不需要任何操作,等待安装完成。 安装完成之后,在命令行敲入vi,按“tab”键。 可以看到,已经有vim命令的存在。 安装成功。 END VIM的配置 刚安装的VIM,可能界面并不是十分友好,这就需要我们去更改vim的配置文件,按照我们的需求去修改它。 在命令行下,输入命令:sudo vim /etc/vim/vimrc 必须加上sudo,否则你是没有权限编辑vimrc的。 在这个文件中,会有这么一句: syntax on 意思是语法高亮,如果您的被注释掉了,请“让它出来”。就像下图所示 下图为小编的VIM配置。 请在您的VIM的最后一行,输入他们,可以让您的VIM变得更漂亮、舒服。 set nu // 在左侧行号 set tabstop //tab 长度设置为 4 set nobackup //覆盖文件时不备份 set

Ubuntu 安装Nginx的APT源

让人想犯罪 __ 提交于 2019-12-20 03:29:04
使用apt安装nginx时,默认是Ubuntu自带的源,版本并不是最新的。 可以使用Ubuntu社区爱好者维护源,地址: https://launchpad.net/~nginx/+archive/ubuntu/stable 。 安装方法很简单: sudo add-apt-repository ppa:nginx/stable sudo apt-get update 然后安装nginx即可: apt-get install nginx 来源: https://www.cnblogs.com/gao88/p/12006519.html