关于我400元捡垃圾并搭建本地服务器的这件事

关于我400元捡垃圾并搭建本地服务器的这件事

前言

其实捡完这台垃圾机器已经是去年12月份的事了(2020.12),不过在那之后之后就一直在宿舍吃灰,最近在玩Docker才又翻出来装上了Debian(Buster),做局域网服务器玩,还可以在平时上课的时候放寝室挂机一些下载或者同步任务。

配置

配置一览,当然绝大部分配件都是二手的

部件型号说明价格(含邮费)来源
主板梅捷 SY-H61L-MiTX板型、带HDMI、mSATA接口¥110.00某鱼二手
CPU英特尔 i3-3245(集显HD 4000)22nm、2 核心 4 线程、3.4GHz¥95.00某宝二手
显卡索泰 GTS 4501GB、nVIDIA GeForce GTS 450¥0.00学长给的
硬盘西部数据 WD5000AAKX 500GB机械硬盘、3.5寸、1423次/2530小时¥50.00某宝二手
内存金士顿 DDR3 2GB*21600MHz、SSTL 1.5V、¥23.00/条¥46.00某宝二手
机箱AY P6 机箱mATX、薄铁皮、略强于鞋盒¥35.90某宝全新
电源全汉 FSP 350W主板24P、SATA及IDE*1、CPU单4P、显卡6+6¥32.15某宝二手
散热酷冷至尊 I30铝、风冷、2600RPM±10%¥16.50某多多全新
合计//¥385.5 5/

装机

虽然已经”云“装机多年,但这是我第一次真正的自己购买配件、自己动手装机🙄

最开始到的是内存条,让某宝店家发的完全一样的两根金士顿2GB DDR3 1600MHz(这个配置”双通道“真的有玄学提升吗?🤣)

内存条

主板是在小黄鱼买的二手梅捷H61的iTX小板,老板是个“咸鱼玩家”,跟他聊了不少,毕竟是第一次装,还好老板挺有耐心,不厌其烦的解答了我很多问题

主板

机箱是本次为数不多非二手的部件了🤣,垃圾佬推荐的杂牌P6机箱,来自某宝,薄铁皮。因为太薄的原因,快递过来的侧板还弯了。客服看到照片二话不说就重新发了快侧板,这价格真的没话说了😂

杂牌P6机箱

其他几个部件当时忘记拍照了,就一一略过吧,毕竟没啥实用意义🙂。虽然是第一次装机,但还是一次点亮,好耶!✌

一次点亮

以前在酷安看到了太多DIY显示器的帖子,显示器是之前自己前年(2019.10)DIY的。十分不建议自己DIY显示器,花费不便宜而且还……反正很不爽👹就是了,也就重装系统的时候用下显示器和键鼠了😥

CPU 选择了酷睿i3-3245,双核心四线程,随便玩玩也够用了。独显是学长后来给的,所以当初选这块U还是主要看中了它集成了英特尔HD 4000核显的原因(不打游戏),下面是英特尔官网给出的参数:

基本要素
产品集传统型英特尔® 酷睿™ 处理器
代号名称先前产品为 Ivy Bridge
垂直市场Desktop
处理器编号i3-3245
状态Discontinued
发行日期Q2’13
光刻22 nm
建议客户价格$144.00
CPU 规格
内核数2
线程数4
处理器基本频率3.40 GHz
缓存3 MB Intel® Smart Cache
总线速度5 GT/s
TDP55 W
补充信息
提供嵌入式方案
数据表立即查看
内存规格
最大内存大小(取决于内存类型)32 GB
内存类型DDR3 1333/1600
最大内存通道数2
最大内存带宽25.6 GB/s
支持的 ECC 内存
处理器显卡
处理器显卡英特尔® 核芯显卡 4000
显卡基本频率650 MHz
显卡最大动态频率1.05 GHz
英特尔® Quick Sync Video
英特尔 InTru 3D 技术
英特尔® Flexible Display Interface
英特尔® 清晰视频核芯技术
支持的显示器数量3
设备 ID0x152
扩展选项
PCI Express 修订版2
PCI Express 配置up to 1x16, 2x8, 1x8 & 2x4
封装规格
支持的插槽FCLGA1155
最大 CPU 配置1
散热解决方案规范2011C
TCASE65.3°C
封装大小37.5mm x 37.5mm
先进技术
英特尔® 睿频加速技术
英特尔® 博锐™ 平台资格
英特尔® 超线程技术
英特尔® 虚拟化技术 (VT-x)
英特尔® Virtualization Technology for Directed I/O (VT-d)
英特尔® VT-x with Extended Page Tables (EPT)
英特尔® 64
指令集64-bit
指令集扩展Intel® SSE4.1, Intel® SSE4.2, Intel® AVX
英特尔® My WiFi 技术
空闲状态
Enhanced Intel SpeedStep® Technology
温度监视技术
英特尔® 身份保护技术
安全性与可靠性
英特尔® AES 新指令
安全密钥
英特尔® Trusted Execution Technology ‡
执行禁用位
防盗技术

系统

装好了后接上显示器和键鼠,用写好PE系统的U盘就可以开始装系统,刚开始装了Windows Server 2019数据中心版(手头没有其他操作系统镜像了)

局域网远程桌面访问

Windows Server平时使用对远程桌面过于依赖,有时候有严重的粘滞感(尤其是刚开机的时候),因此感觉不适合做本地服务器。用“娱乐大师”跑了个分后就去下载了Debian系统镜像写入U盘,装进了机器,然后平时管理通过局域网SSH。

装好独显驱动后

显卡驱动

在BIOS里屏蔽了核显,仅使用独显(我不用桌面环境,好像也没啥用😂),下面记录下简单安装这个上古英伟达GTS 450显卡驱动的过程:

1
2
3
4
5
6
# 前提已经安装配置好sudoer或者使用root账户操作
$ sudo apt update
# 安装nvidia-detect软件包
$ sudo apt install nvidia-detect
# 查看显卡信息
$ lspci -nn | egrep -i "3d|display|vga"

输出信息如下:

1
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF116 [GeForce GTS 450 Rev. 2] [10de:1245] (rev a1)
1
2
# 使用nvidia-detect查看推荐安装驱动软件包信息
$ nvidia-detect

输出信息如下:

1
2
3
4
5
6
7
8
Detected NVIDIA GPUs:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF116 [GeForce GTS 450 Rev. 2] [10de:1245] (rev a1)

Checking card: NVIDIA Corporation GF116 [GeForce GTS 450 Rev. 2] (rev a1)
Your card is only supported up to the 390 legacy drivers series.
It is recommended to install the
nvidia-legacy-390xx-driver
package.

按照输出的实际内容接下来操作:

1
2
3
4
5
6
# 更新软件源
$ apt update
# 安装推荐的英伟达显卡驱动程序包
$ apt install nvidia-legacy-390xx-driver
# 因为不需要配置桌面环境,安装完成后重启即可
$ sudo reboot

安装Docker

按照 Docker 官方文档的方法安装Docker:

操作系统要求:

  • Debian Bullseye 11(测试)

  • Debian Buster 10(稳定)

  • Raspbian Bullseye 11(测试)

  • Raspbian Buster 10(稳定)

Docker Engine在x86_64(或amd64armhf,和arm64体系结构上受支持。

按照官方文档,设置Docker的存储库安装Docker的方式是比较推荐的,今后也可以简化升级任务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 更新Debian软件源
$ sudo apt-get update
# 安装几个需要的软件包
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
# 添加Docker的官方GPG密钥
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# 默认情况下使用下面命令设置稳定版的存储库,推荐用于生产环境
$ echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 更新软件源
$ sudo apt-get update
# 安装Docker引擎和容器,根据网速情况,稍等片刻即可😎
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

完整日志(凑个字数🤡):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Linux debian 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun May 23 19:43:56 2021 from 192.168.0.104
xxx@debian:~$ sudo apt-get update
[sudo] password for xxx:
Hit:1 http://mirrors.huaweicloud.com/debian buster InRelease
Get:2 http://mirrors.huaweicloud.com/debian buster-updates InRelease [51.9 kB]
Hit:3 http://security.debian.org/debian-security buster/updates InRelease
Fetched 51.9 kB in 1s (65.0 kB/s)
Reading package lists... Done
xxx@debian:~$ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20200601~deb10u2).
gnupg is already the newest version (2.2.12-1+deb10u1).
gnupg set to manually installed.
lsb-release is already the newest version (10.2019051400).
curl is already the newest version (7.64.0-4+deb10u2).
The following NEW packages will be installed:
apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 149 kB of archives.
After this operation, 156 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.huaweicloud.com/debian buster-updates/main amd64 apt-transport-https all 1.8.2.3 [149 kB]
Fetched 149 kB in 0s (751 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 76662 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.8.2.3_all.deb ...
Unpacking apt-transport-https (1.8.2.3) ...
Setting up apt-transport-https (1.8.2.3) ...
xxx@debian:~$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
xxx@debian:~$ echo \
> "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
> $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
xxx@debian:~$ sudo apt-get update
Hit:1 http://mirrors.huaweicloud.com/debian buster InRelease
Hit:2 http://mirrors.huaweicloud.com/debian buster-updates InRelease
Hit:3 http://security.debian.org/debian-security buster/updates InRelease
Get:4 https://download.docker.com/linux/debian buster InRelease [44.4 kB]
Get:5 https://download.docker.com/linux/debian buster/stable amd64 Packages [18.7 kB]
Fetched 63.1 kB in 2s (39.6 kB/s)
Reading package lists... Done
xxx@debian:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
docker-ce-rootless-extras docker-scan-plugin pigz
Suggested packages:
aufs-tools cgroupfs-mount | cgroup-lite
Recommended packages:
slirp4netns
The following NEW packages will be installed:
containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin pigz
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 107 MB of archives.
After this operation, 465 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.huaweicloud.com/debian buster/main amd64 pigz amd64 2.4-1 [57.8 kB]
Get:2 https://download.docker.com/linux/debian buster/stable amd64 containerd.io amd64 1.4.4-1 [28.3 MB]
Get:3 https://download.docker.com/linux/debian buster/stable amd64 docker-ce-cli amd64 5:20.10.6~3-0~debian-buster [41.4 MB]
Get:4 https://download.docker.com/linux/debian buster/stable amd64 docker-ce amd64 5:20.10.6~3-0~debian-buster [24.8 MB]
Get:5 https://download.docker.com/linux/debian buster/stable amd64 docker-ce-rootless-extras amd64 5:20.10.6~3-0~debian-buster [9,063 kB]
Get:6 https://download.docker.com/linux/debian buster/stable amd64 docker-scan-plugin amd64 0.7.0~debian-buster [3,885 kB]
Fetched 107 MB in 15s (7,119 kB/s)
Selecting previously unselected package pigz.
(Reading database ... 76666 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.4-1_amd64.deb ...
Unpacking pigz (2.4-1) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../1-containerd.io_1.4.4-1_amd64.deb ...
Unpacking containerd.io (1.4.4-1) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../2-docker-ce-cli_5%3a20.10.6~3-0~debian-buster_amd64.deb ...
Unpacking docker-ce-cli (5:20.10.6~3-0~debian-buster) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../3-docker-ce_5%3a20.10.6~3-0~debian-buster_amd64.deb ...
Unpacking docker-ce (5:20.10.6~3-0~debian-buster) ...
Selecting previously unselected package docker-ce-rootless-extras.
Preparing to unpack .../4-docker-ce-rootless-extras_5%3a20.10.6~3-0~debian-buster_amd64.deb ...
Unpacking docker-ce-rootless-extras (5:20.10.6~3-0~debian-buster) ...
Selecting previously unselected package docker-scan-plugin.
Preparing to unpack .../5-docker-scan-plugin_0.7.0~debian-buster_amd64.deb ...
Unpacking docker-scan-plugin (0.7.0~debian-buster) ...
Setting up docker-scan-plugin (0.7.0~debian-buster) ...
Setting up containerd.io (1.4.4-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up docker-ce-cli (5:20.10.6~3-0~debian-buster) ...
Setting up pigz (2.4-1) ...
Setting up docker-ce-rootless-extras (5:20.10.6~3-0~debian-buster) ...
Setting up docker-ce (5:20.10.6~3-0~debian-buster) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for systemd (241-7~deb10u7) ...
xxx@debian:~$

后续若要卸载Docker引擎和所有容器:

1
2
3
$ sudo apt-get purge docker-ce docker-ce-cli containerd.io
$ sudo rm -rf /var/lib/docker
$ sudo rm -rf /var/lib/containerd

docker-compose

Compose 是用于定义和运行多容器 Docker 应用程序的工具。通过 Compose,您可以使用 YML 文件来配置应用程序需要的所有服务。然后,使用一个命令,就可以从 YML 文件配置中创建并启动所有服务。

1
2
3
4
5
6
7
8
9
10
11
# 安装最新版docker-compose,将1.29.2换成你需要的版本号
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# 给予权限
$ sudo chmod +x /usr/local/bin/docker-compose
# 创建软链接
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 验证安装成功
$ docker-compose --version
# 类似输出如下:
root@debian:~# docker-compose --version
docker-compose version 1.29.2, build 5becea4c

结语

因为是第一次装机,所以没能达到垃圾佬的正常水平,不过这次体验还是很奇妙的。实际动手比“纸上谈兵”还是要有意思多的!😋

关于我400元捡垃圾并搭建本地服务器的这件事

https://spoience.com/articles/initial-assembled-computer.html

作者

Spoience

发布于

2021-05-23

更新于

2021-05-30

许可协议

评论