Ubuntu下ClickHouse安装

用 root 身份运行, 注意在install那一步, 不要设置密码

bash 复制代码
# 使用官方安装源,跳过签名验证。(因为使用 gpg 完全通过代理获取签名的问题至今没有解决。)
echo 'deb [trusted=yes] https://packages.clickhouse.com/deb stable main' > /etc/apt/sources.list.d/clickhouse.list
apt update

# 安装最新版
apt install -y clickhouse-{server,client}

# 也可以指定安装精确的版本号
apt list -a clickhouse-server | head
apt install -y clickhouse-{server,client}=23.12.2.59

# 启动服务并配置开机自动启动
systemctl start clickhouse-server
systemctl enable clickhouse-server

如果不小心设置了密码, 设置/etc/clickhouse-server/users.d/default-password.xml为如下内容

复制代码
<clickhouse>
<users>
<default>
<password></password>
</default>
</users>
</clickhouse>

另外, 检查/etc/clickhouse-server/config.d/listen.xml文件是否存在

如果没有, 创建该文件, 添加如下内容

复制代码
<clickhouse>
<listen_host>::</listen_host>
</clickhouse>

再重启clickhouse

复制代码
systemctl restart clickhouse-server

这样同内网的其他机器即可通过远程9000端口来访问该clickhouse, 否则其只能提供本地访问服务

复制代码
clickhouse-client --host 10.0.0.X

如果service启动不了, 可以手动启动clickhouse-server --config-file=/etc/clickhouse-server/config.xml查看原因

若遇到报错

复制代码
Effective user of the process (root) does not match the owner of the data (clickhouse). Run under 'sudo -u clickhouse'

则使用chown -R clickhouse:clickhouse /var/lib/clickhouse可修复问题

相关推荐
DYWorker0011 小时前
Linux驱动子系统:DMA-Buf —— Consumer和Provider(008)
linux·驱动开发
雯宝2 小时前
Linux 内核函数集
linux
GeW2 小时前
从挂科到高分通过:RHCE快速拿证的10个提分技巧
linux
我本善良ab3 小时前
PVE使用GRUB如何复位ubuntu的管理员密码?
ubuntu·忘记密码
鸠摩智首席音效师3 小时前
Linux /etc/nsswitch.conf 文件有什么作用 ?
linux
东城居士3 小时前
理解pinctrl和gpio子系统驱动
linux·嵌入式系统
H_oRIZoN_3 小时前
Linux入门DAY43 ARM 架构基础、寄存器、大小端、异常向量、交叉编译
linux·arm·linux应用编程
ι:4 小时前
NUC12 Pro 安装 Ubuntu 24.04 LTS 详细教程
linux·windows·ubuntu·nuc
代码村新手5 小时前
Linux-进程概念
linux
ShineWinsu5 小时前
对于Git:基础操作的超详细保姆级解析
linux·c++·git·面试·备份·管理·版本控制器