AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-609471

Dave's questions

Martin Hope
Dave
Asked: 2020-04-21 08:39:56 +0800 CST

为什么“usermod -a -G”没有将我的用户添加到组中?

  • 3

我正在使用 Ubuntu 18.04。我想将我的用户“davea”添加到组“www-data”中。我试过这个

(venv) davea@chicommons-laboratory:/var/www/html/web$ groups
davea sudo
(venv) davea@chicommons-laboratory:/var/www/html/web$ sudo usermod -a -G www-data davea
[sudo] password for davea: 
(venv) davea@chicommons-laboratory:/var/www/html/web$ groups
davea sudo

但是正如您所看到的,即使该命令没有给出任何错误,我的用户仍然没有添加到组中。我究竟做错了什么?

permissions groups
  • 3 个回答
  • 4605 Views
Martin Hope
Dave
Asked: 2019-08-08 10:49:05 +0800 CST

如何在不重新安装 docker 的情况下启用 docker 作为服务?

  • 6

我正在使用 Ubuntu 16.04。我想将 Docker 设置为作为服务运行。我已经安装了docker...

davea@blockshare_srvr:~$ which docker
/snap/bin/docker
davea@blockshare_srvr:~$ /snap/bin/docker -v
Docker version 18.06.1-ce, build e68fc7a

但是当我尝试检查其状态时,出现以下错误

davea@blockshare_srvr:~$ sudo systemctl status docker
Unit docker.service could not be found.

如何在不重新安装 docker 的情况下启用该服务?

software-installation services docker
  • 2 个回答
  • 7720 Views
Martin Hope
Dave
Asked: 2017-11-15 12:34:07 +0800 CST

尝试从 Git 存储库克隆时获取“权限被拒绝(公钥)”

  • 1

我正在尝试在我的机器上从源代码安装不朽。但是,每当我运行时git clone(如说明中所述),我都会收到以下错误消息:

myuser@mysite:~$ git clone [email protected]:immortal/immortal.git $HOME/go/src/github.com/immortal/immortal
Cloning into '/home/myuser/go/src/github.com/immortal/immortal'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

有谁知道这意味着什么以及如何解决它?

ssh
  • 1 个回答
  • 4080 Views
Martin Hope
Dave
Asked: 2017-06-23 06:46:56 +0800 CST

为什么只有我的一些日志被轮换?

  • 5

我正在使用 Ubuntu 14.04。我的 /etc/logrotate.conf 文件中有以下内容...

/home/rails/myproject/log {
        daily
        rotate 3
        compress
        delaycompress
        missingok
        notifempty
        create 644 rails rails
}

/var/log/postgresql {
        daily
        rotate 3
        compress
        delaycompress
        missingok
        notifempty
        create 644 root root
}

每天晚上,我都会查看我的 Rails 原木,它总是会更大——也就是说,原木似乎没有旋转......

myuser@myproject:~$ ls -al /home/rails/myproject/log
total 4574368
drwxr-xr-x  2 rails rails       4096 May 30 12:04 .
drwxr-xr-x 15 rails rails       4096 May 30 12:03 ..
-rw-rw-r--  1 rails rails      14960 Jun  1 22:39 development.log
-rw-rw-r--  1 rails rails          0 Oct 22  2016 .keep
-rw-r--r--  1 rails rails 4523480004 Jun 22 10:19 production.log
-rw-rw-r--  1 rails rails  156358087 Jun 22 10:19 sidekiq.log
-rw-rw-r--  1 rails rails      54246 Apr 10 14:34 test.log

当我手动运行命令时,我看到一些日志似乎被轮换了......

myuser@myproject:~$ sudo logrotate /etc/logrotate.conf
myuser@myproject:~$ ls -al /home/rails/myproject/log
total 4570288
drwxr-xr-x  2 rails rails       4096 Jun 22 10:22 .
drwxr-xr-x 15 rails rails       4096 May 30 12:03 ..
-rw-rw-r--  1 rails rails          0 Jun 22 10:22 development.log
-rw-rw-r--  1 rails rails      14960 Jun  1 22:39 development.log.1
-rw-rw-r--  1 rails rails          0 Oct 22  2016 .keep
-rw-r--r--  1 rails rails          0 Jun 22 10:22 production.log
-rw-r--r--  1 rails rails 4523505906 Jun 22 10:23 production.log.1
-rw-rw-r--  1 rails rails  156369048 Jun 22 10:23 sidekiq.log
-rw-rw-r--  1 rails rails      54246 Apr 10 14:34 test.log

我如何弄清楚为什么我的 Rails 日志不是每晚轮换一次?请注意,系统中的其他日志似乎是。上面,我包含了我的 postgres 配置,当我查看那里的日志时,似乎正在正常旋转......

myuser@myproject:~$ ls -al /var/log/postgresql
total 1832
drwxrwxr-t  2 root     postgres    4096 May  2 20:42 .
drwxr-xr-x 13 root     root        4096 Jun 22 10:22 ..
-rw-r-----  1 postgres adm      1861361 Jun 22 10:14 postgresql-9.6-main.log

谢谢, - 戴夫

编辑:将配置放在单独的文件中似乎没有做任何事情。以下是我的配置以及似乎没有轮换的日志...

myuser@myapp:~$ sudo cat /etc/logrotate.d/myapp
[sudo] password for myuser:
/home/rails/myapp/log/*.log {
   daily
   missingok
   compress
   notifempty
   rotate 12
   create
   delaycompress
   missingok
   su rails rails
}

这是日志。好像什么都没发生...

myuser@myapp:~$ ls -al /home/rails/myapp/log
total 4635956
drwxr-xr-x  2 rails rails       4096 Jun 22 10:22 .
drwxr-xr-x 15 rails rails       4096 May 30 12:03 ..
-rw-rw-r--  1 rails rails          0 Jun 22 10:22 development.log
-rw-rw-r--  1 rails rails      14960 Jun  1 22:39 development.log.1
-rw-rw-r--  1 rails rails          0 Oct 22  2016 .keep
-rw-r--r--  1 rails rails          0 Jun 22 10:22 production.log
-rw-r--r--  1 rails rails 4546785231 Jun 24 12:12 production.log.1
-rw-rw-r--  1 rails rails  200336693 Jun 24 12:51 sidekiq.log
-rw-rw-r--  1 rails rails      54246 Apr 10 14:34 test.log
files
  • 3 个回答
  • 2441 Views
Martin Hope
Dave
Asked: 2017-06-22 12:55:33 +0800 CST

如何增加交换文件的大小而不在终端中删除它?

  • 154

有没有办法增加我现有的“交换文件”而不必破坏和重新创建它?我想将交换空间从 1GB 增加到 2GB。目前它是这样设置的:

$ sudo swapon -s
Filename                Type        Size    Used    Priority
/swapfile               file        1048572 736640  -1
$ ls -lh /swapfile
-rw------- 1 root root 1.0G Nov  9  2016 /swapfile

我正在使用 Ubuntu 14.04。

command-line
  • 6 个回答
  • 130724 Views
Martin Hope
Dave
Asked: 2017-01-24 12:26:53 +0800 CST

如何在 awk 语句中转义撇号?

  • 5

我正在使用带有 bash shell 的 Ubuntu Linux。如何在 awk 语句中转义撇号?在使用 awk 从文件中提取数据后,我想输出一些 SQL,所以我有:

awk -F',' '{print "SELECT * from user where id = '"$2"';"}' myfile.csv

但这仅打印出来:

SELECT * from user where id = ;

如果我将以上内容修改为

awk -F',' '{print "SELECT * from user where id = "$2";"}' myfile.csv

然后我得到一个声明

SELECT * from user where id = cf915247dfcf47b6814b5350e5cbdfd8;

但是我需要的 id 周围没有单引号。

command-line
  • 3 个回答
  • 5090 Views
Martin Hope
Dave
Asked: 2017-01-11 12:03:35 +0800 CST

如何在终端中打开一个大文件(使用 vim 导致终端挂起)?[复制]

  • 12
这个问题在这里已经有了答案:
用于编辑大型(4.3 GB)纯文本文件的文本编辑器 (15 个答案)
5年前关闭。

我正在使用 Ubuntu 14.04。我有一个很大的日志文件:

-rw-r--r-- 1 rails root 1792390124 Jan 10 14:54 /var/log/unicorn/unicorn.log

尽管如此,我需要打开它并在其中找到一些东西。我试过vim,但正在运行

vim /var/log/unicorn/unicorn.log

只是打开一个空白屏幕,即使我使用Ctrl+ C,也没有任何反应。终端挂起。如果不升级我机器上的任何硬件(但我愿意安装软件),我如何打开文件并环顾四周(我不需要编辑它,我只需要从中读取一些行)。

command-line
  • 4 个回答
  • 11952 Views
Martin Hope
Dave
Asked: 2016-11-04 12:01:09 +0800 CST

在 Ubuntu 服务器上运行任何命令都会返回“无法分配内存”

  • 25

我正在使用 Ubuntu 14.04。最近,当我使用具有 sudo 权限的用户通过 SSH 登录时,我运行的每个命令都会导致“无法分配内存”错误。这是我在控制台上尝试过的一些

myuser@mymachine:~$ whoami
-bash: fork: Cannot allocate memory
myuser@mymachine:~$ uname -a
-bash: fork: Cannot allocate memory

即使我尝试sudo reboot now我得到上述错误,所以我不知道我还能尝试解锁我的实例。如果重要的话,主机是 DigitalOcean。

编辑:根据这里给出的答案/建议是“免费”的输出

myuser@mymachine:~$ free
-bash: fork: Cannot allocate memory
server
  • 4 个回答
  • 150755 Views
Martin Hope
Dave
Asked: 2016-10-21 10:41:38 +0800 CST

如何在我的 Ubuntu 系统上升级到 Ruby 2.2?

  • 16

我正在使用 Ubuntu Linux。以下是uname信息

myuser@myinstance:~$ uname -a
Linux myinstance 3.18.0-52-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

我正在尝试升级我机器上的 Ruby 版本,该版本目前安装在

/usr/lib/ruby/1.9.1

我尝试遵循此处的建议 —通过 apt 安装 ruby​​ 2.2.3,但不幸的是,我收到错误消息“替代路径 /usr/bin/ruby2.2 不存在”。升级我的系统以使用 Ruby 2.2 或更高版本的正确方法是什么?

myuser@myinstance:~/racertracks$ sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.2 400 \
>  --slave /usr/bin/rake rake /usr/bin/rake2.2 \
>  --slave /usr/bin/ri ri /usr/bin/ri2.2 \
>  --slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.2 \
>  --slave /usr/bin/gem gem /usr/bin/gem2.2 \
>  --slave /usr/bin/irb irb /usr/bin/irb2.2 \
>  --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz /usr/share/man/man1/ruby2.2.1.gz \
>  --slave /usr/share/man/man1/rake.1.gz rake.1.gz /usr/share/man/man1/rake2.2.1.gz \
>  --slave /usr/share/man/man1/ri.1.gz ri.1.gz /usr/share/man/man1/ri2.2.1.gz \
>  --slave /usr/share/man/man1/rdoc.1.gz rdoc.1.gz /usr/share/man/man1/rdoc2.2.1.gz \
>  --slave /usr/share/man/man1/gem.1.gz gem.1.gz /usr/share/man/man1/gem2.2.1.gz \
>  --slave /usr/share/man/man1/irb.1.gz irb.1.gz /usr/share/man/man1/irb2.2.1.gz
update-alternatives: error: alternative path /usr/bin/ruby2.2 doesn't exist
apt
  • 2 个回答
  • 52000 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve