2023年折騰玩客云OneCloud記錄

1.更換國內(nèi)源

cp /etc/apt/sources.list /etc/apt/sources.list.bak

sudo nano /etc/apt/sources.list

# 默認(rèn)注釋了源碼鏡像以提高 apt update 速度

# 清華大學(xué)的軟件源

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

# 阿里云的軟件源

# deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib

# deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib

# deb https://mirrors.aliyun.com/debian-security/ bullseye-security main

# deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main

# deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib

# deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib

# deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

# deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

# 中科大的軟件源

# deb https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free

# deb-src https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free

# deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free

# deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free

# deb https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free

# deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free

# deb https://mirrors.ustc.edu.cn/debian-security bullseye-security main contrib non-free

# deb-src https://mirrors.ustc.edu.cn/debian-security bullseye-security main contrib non-free

2.更新軟件

sudo apt update && sudo apt upgrade -y

3.下載hosts

sed -i "/# GitHub520 Host Start/Q" /etc/hosts && curl https://raw.hellogithub.com/hosts >> /etc/hosts

docker pull dockerproxy.com/homeassistant/home-assistant:latest

4.安裝casaos

wget -qO- https://get.casaos.io | sudo bash

5.安裝HACS

進(jìn)入容器

sudo docker exec -it HomeAssistant /bin/bash

wget -O - https://get.hacs.xyz | bash -

wget -O - https://raw.githubusercontent.com/hacs/get/main/get | bash -

6.安裝Xiaomi Miot Auto

29312056

登錄不上改host

tee -i /etc/hosts <<-'EOF'

#TMDB.ORG

18.66.15.21 www.themoviedb.org

18.66.15.36 api.themoviedb.org

13.32.110.58 api.tmdb.org

143.244.50.86 image.tmdb.org

183.84.6.64 sts.api.io.mi.com

123.125.103.173 api.io.mi.com

111.202.0.183 account.xiaomi.com

EOF

wget -qO - https://raw.hellogithub.com/hosts | cat - >> /etc/hosts

18.66.15.21 www.themoviedb.org

18.66.15.36 api.themoviedb.org

13.32.110.58 api.tmdb.org

143.244.50.86 image.tmdb.org

183.84.6.64 sts.api.io.mi.com

123.125.103.173 api.io.mi.com

111.202.0.183 account.xiaomi.com

5.固定ip地址

sudo nano /etc/network/interfaces

先修改iface eth0 inet dhcp 為 iface eth0 inet static,然后添加

#? ? ? iface eth0 inet static

? ? ? address 192.168.1.41

? ? ? netmask 255.255.255.0

? ? ? gateway 192.168.1.1

? ? ? dns-nameservers 114.114.114.114 8.8.4.4

導(dǎo)入備份的json文件

刪除docker中無用的鏡像

docker system prune

opwrt

docker pull dockerproxy.com/w8ves/openwrt:onecloud

1.打開網(wǎng)卡混雜模式

sudo ip link set eth0 promisc on

2.創(chuàng)建網(wǎng)絡(luò)

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=eth0 macnet

刪除docker網(wǎng)絡(luò): docker network rm macnet

docker run --restart always --name openwrt -d --network macnet --ip 192.168.1.252 --privileged dockerproxy.com/w8ves/openwrt:onecloud /sbin/init

docker exec -it openwrt /bin/bash

vi /etc/network/interfaces

將地址修成成192.168.1.252

重啟網(wǎng)絡(luò)

/etc/init.d/network restart

宿主機(jī)

nano /etc/network/interfaces

up ip link set eth0 promisc on? # 添加這一行代碼

用于永久開啟混雜模式

src/gz openwrt_core https://mirrors.cloud.tencent.com/lede/snapshots/targets/at91/sama5/packages

src/gz openwrt_base https://mirrors.cloud.tencent.com/lede/snapshots/packages/arm_cortex-a5_vfpv4/base

#src/gz openwrt_freifunk https://mirrors.cloud.tencent.com/lede/snapshots/packages/arm_cortex-a5_vfpv4/freifunk

src/gz openwrt_freifunk https://mirrors4.tuna.tsinghua.edu.cn/lede/releases/19.07.6/packages/arm_cortex-a5_vfpv4/freifunk

#src/gz openwrt_helloworld https://mirrors.cloud.tencent.com/lede/snapshots/packages/arm_cortex-a5_vfpv4/helloworld

src/gz openwrt_luci https://mirrors.cloud.tencent.com/lede/releases/18.06.8/packages/arm_cortex-a5_vfpv4/luci

src/gz openwrt_packages https://mirrors.cloud.tencent.com/lede/snapshots/packages/arm_cortex-a5_vfpv4/packages

src/gz openwrt_routing https://mirrors.cloud.tencent.com/lede/snapshots/packages/arm_cortex-a5_vfpv4/routing

src/gz openwrt_telephony https://mirrors.cloud.tencent.com/lede/snapshots/packages/arm_cortex-a5_vfpv4/telephony

src/gz openwrt_core https://archive.openwrt.org/releases/21.02.1/targets/at91/sama5/packages

src/gz openwrt_base https://archive.openwrt.org/releases/21.02.1/packages/arm_cortex-a5_vfpv4/base

https://mirrors.ustc.edu.cn/openwrt/releases/packages-19.07/arm_cortex-a5_vfpv4/telephony/

/lede/releases/19.07.1/targets/at91/sama5/packages

https://archive.openwrt.org/releases/21.02.1/targets/at91/sama5/packages/

玩客云搭建MQTT服務(wù)器

下載安裝#

wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key

sudo apt-key add mosquitto-repo.gpg.key

cd /etc/apt/sources.list.d/

sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list

sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list

sudo wget http://repo.mosquitto.org/debian/mosquitto-buster.list

apt-get update -y

apt-cache search mosquitto

apt-get install -y mosquitto mosquitto-clients

常用命令#

sudo service mosquitto status? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #查看運(yùn)行狀態(tài)

sudo service mosquitto start? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #啟動(dòng)服務(wù)

sudo service mosquitto stop? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #停止服務(wù)

修改配置文件#

MQTT服務(wù)器安裝了之后冲秽,默認(rèn)監(jiān)聽localhost的1883端口,外網(wǎng)不能夠進(jìn)行訪問矛绘。如果有需要可以修改配置文件运翼。用戶的局部配置文件放在:

/etc/mosquitto/conf.d/目錄下辙浑,并且這個(gè)目錄下的所有以.conf后綴的文件都將被mosquitto作為配置文件升略,在啟動(dòng)時(shí)加載偎巢。

首先蔼夜,我們將創(chuàng)建一個(gè)Mosquitto將用于驗(yàn)證連接的密碼文件。使用mosquitto_passwd來創(chuàng)建這個(gè)文件艘狭,請(qǐng)確保使用你喜歡的用戶名替換它:

sudo mosquitto_passwd -c /etc/mosquitto/passwd your-username? ? #系統(tǒng)將提示您輸入兩次密碼挎扰。

在/etc/mosquitto/conf.d 目錄下翠订,新建myconfig.conf配置文件:

allow_anonymous false? #不允許匿名訪問

password_file /etc/mosquitto/passwd? ? #密碼文件位置

listener 1883 0.0.0.0? #監(jiān)聽的端口和IP地址

重啟Mosquitto以獲取配置更改:

sudo systemctl restart mosquitto

檢查以確保服務(wù)再次運(yùn)行:

sudo systemctl status mosquitto

● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker

? Loaded: loaded (/etc/init.d/mosquitto; generated)

? Active: active (running) since Mon 2018-07-16 15:03:42 UTC; 2min 39s ago

? ? Docs: man:systemd-sysv-generator(8)

? Process: 6683 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCESS)

? Process: 6699 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)

? ? Tasks: 1 (limit: 1152)

? CGroup: /system.slice/mosquitto.service

? ? ? ? ? └─6705 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

狀態(tài)應(yīng)該是active (running)巢音。如果不是,請(qǐng)檢查配置文件并重新啟動(dòng)尽超。Mosquitto的日志文件中可能會(huì)提供更多信息:

sudo tail /var/log/mosquitto/mosquitto.log

測試MQTT#

測試Mosquitto#

我們?cè)诓襟E1中安裝了一些命令行MQTT客戶端官撼。我們可以在localhost監(jiān)聽器上訂閱主題測試,如下所示:

mosquitto_sub -h localhost -t test -u "your-user" -P "your-password"

我們可以用mosquitto_pub發(fā)布:

mosquitto_pub -h localhost -t test -m "hello world" -u "your-user" -P "your-password"

作者:staluo

出處:https://www.cnblogs.com/stry/articles/17036664.html

版權(quán):本作品采用「署名-非商業(yè)性使用-相同方式共享 4.0 國際」許可協(xié)議進(jìn)行許可似谁。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末傲绣,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子巩踏,更是在濱河造成了極大的恐慌秃诵,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,277評(píng)論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件塞琼,死亡現(xiàn)場離奇詭異菠净,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,689評(píng)論 3 393
  • 文/潘曉璐 我一進(jìn)店門毅往,熙熙樓的掌柜王于貴愁眉苦臉地迎上來牵咙,“玉大人,你說我怎么就攤上這事攀唯〗嘧溃” “怎么了?”我有些...
    開封第一講書人閱讀 163,624評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵侯嘀,是天一觀的道長另凌。 經(jīng)常有香客問我,道長戒幔,這世上最難降的妖魔是什么途茫? 我笑而不...
    開封第一講書人閱讀 58,356評(píng)論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮溪食,結(jié)果婚禮上囊卜,老公的妹妹穿的比我還像新娘。我一直安慰自己错沃,他們只是感情好栅组,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,402評(píng)論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著枢析,像睡著了一般玉掸。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上醒叁,一...
    開封第一講書人閱讀 51,292評(píng)論 1 301
  • 那天司浪,我揣著相機(jī)與錄音,去河邊找鬼把沼。 笑死啊易,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的饮睬。 我是一名探鬼主播租谈,決...
    沈念sama閱讀 40,135評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢(mèng)啊……” “哼捆愁!你這毒婦竟也來了割去?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 38,992評(píng)論 0 275
  • 序言:老撾萬榮一對(duì)情侶失蹤昼丑,失蹤者是張志新(化名)和其女友劉穎呻逆,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體菩帝,經(jīng)...
    沈念sama閱讀 45,429評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡咖城,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,636評(píng)論 3 334
  • 正文 我和宋清朗相戀三年憔足,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片酒繁。...
    茶點(diǎn)故事閱讀 39,785評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡滓彰,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出州袒,到底是詐尸還是另有隱情揭绑,我是刑警寧澤,帶...
    沈念sama閱讀 35,492評(píng)論 5 345
  • 正文 年R本政府宣布郎哭,位于F島的核電站他匪,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏夸研。R本人自食惡果不足惜邦蜜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,092評(píng)論 3 328
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望亥至。 院中可真熱鬧悼沈,春花似錦、人聲如沸姐扮。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,723評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽茶敏。三九已至壤靶,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間惊搏,已是汗流浹背贮乳。 一陣腳步聲響...
    開封第一講書人閱讀 32,858評(píng)論 1 269
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留恬惯,地道東北人向拆。 一個(gè)月前我還...
    沈念sama閱讀 47,891評(píng)論 2 370
  • 正文 我出身青樓,卻偏偏與公主長得像宿崭,于是被迫代替她去往敵國和親亲铡。 傳聞我的和親對(duì)象是個(gè)殘疾皇子才写,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,713評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容