Here's how I host my own AIM server

Here’s how I host my own AIM server

如何搭建属于你自己的 AIM 服务器

In high school, most days began and ended with AIM. This was before everyone had text messages (or cell phones). Everything from class projects to entire relationships took place in an AIM window. Needless to say, I have some nostalgia for it. 在高中时期,我每天的生活几乎都是以 AIM 开始,又以 AIM 结束。那是在人人都有短信(或手机)普及之前的日子。从课堂作业到各种人际关系,一切都在 AIM 的聊天窗口中发生。不用说,我对它有着深厚的情怀。

Discord hasn’t been treating me well recently, so I decided to give Open OSCAR Server a try, which lets you spin up an AIM/ICQ server and connect many old clients up to it, and I’m glad I did! 最近 Discord 的体验不太好,所以我决定尝试一下 Open OSCAR Server。它允许你搭建一个 AIM/ICQ 服务器,并连接许多旧版客户端。我很庆幸自己这么做了!

I talked about this more in-depth in a recent video (YouTube/PeerTube), and my friend Kate (Macintosh Librarian) posted a video as well covering AIM in greater detail. But I figured I’d put a blog post together going into the specifics of how I’m hosting it. Maybe it’ll help you try out AIM again! 我在最近的一段视频(YouTube/PeerTube)中深入探讨过这个话题,我的朋友 Kate(Macintosh Librarian)也发布了一段视频,更详细地介绍了 AIM。但我还是决定写一篇博客文章,详细说明我是如何搭建它的。也许这能帮你重新体验一下 AIM!

Set up a Debian Trixie server

设置 Debian Trixie 服务器

I won’t go into how to install Debian Trixie… that’s a whole different topic, and this post assumes you already have that information under your hat. 我不会在这里介绍如何安装 Debian Trixie……那是另一个话题了,本文假设你已经掌握了相关知识。

You can pretty easily get this working on a low-spec VPS, assuming you don’t have hundreds of users you’re planning on chatting with. I hosted mine at home for a bit but moved it to a bottom-tier VPS when I started sharing it with friends. It’d probably work with a Raspberry Pi as well, although I haven’t tried it yet. 如果你不打算让成百上千人同时聊天,在低配置的 VPS 上运行它非常容易。我起初是在家里搭建的,但后来开始与朋友分享时,就把它迁移到了一个入门级的 VPS 上。它应该也能在树莓派上运行,尽管我还没试过。

If you’re hosting at home, or otherwise behind a firewall, you’ll need to open a port for AIM (the default is 5190). Clients will connect with that port. Some clients might not be able to easily switch the port, so it’s probably best to stick with the default here. 如果你是在家里托管,或者处于防火墙之后,你需要为 AIM 打开一个端口(默认是 5190)。客户端将通过该端口进行连接。有些客户端可能无法轻易更改端口,所以最好还是使用默认端口。

If you’re hosting it at home and don’t have a static IP address, you’ll want a dynamic DNS provider. I personally use No-IP (not sponsored) and I’m happy with the results, but dealing with dynamic DNS can be a challenge for the uninitiated: if you’re willing to part with $5-$10 USD/mo, cloud providers will make this much easier (and with a static IP). 如果你在家里托管且没有静态 IP 地址,你需要一个动态 DNS 服务商。我个人使用 No-IP(非赞助),对结果很满意。但对于新手来说,处理动态 DNS 可能是一个挑战:如果你愿意每月支付 5-10 美元,云服务商会让这一切变得简单得多(并且提供静态 IP)。

The important thing is that your server is reachable through either a fixed IP address, or a domain name, and has that open port (5190 by default). I also recommend setting up your firewall to reject traffic from sources that aren’t you, at least while configuring Open OSCAR Server. The server defaults are pretty open, which is great for a fun project inside your home network, but they aren’t really suitable for sharing on the internet, so until you have those locked down, firewall rules are your friend. 重要的是,你的服务器可以通过固定 IP 地址或域名访问,并且开放了那个端口(默认 5190)。我还建议在配置 Open OSCAR Server 时,至少先设置防火墙拒绝来自非信任来源的流量。服务器的默认设置非常开放,这对于家庭网络内的趣味项目来说很好,但并不适合直接暴露在互联网上,所以在你做好安全加固之前,防火墙规则是你最好的朋友。

Installing Open OSCAR Server and testing

安装并测试 Open OSCAR Server

Download Open OSCAR Server. Open OSCAR Server uses GitHub to publish releases. Head on over to the repo and snag a release. I prefer to do this via wget while SSH’d into my server: wget [RELEASE URL]. Of course, replace [RELEASE URL] with the actual URL of the .tar.gz file from the project. 下载 Open OSCAR Server。Open OSCAR Server 使用 GitHub 发布版本。前往仓库获取一个版本。我更喜欢在 SSH 连接到服务器时使用 wget [RELEASE URL] 来完成。当然,请将 [RELEASE URL] 替换为项目中 .tar.gz 文件的实际链接。

Then, once I had it, I extracted it with tar: tar -zxvf open_oscar_server.X.XX.X.linux.x86_64.tar.gz. Of course, replace the X.XX.X with the version you downloaded. 获取文件后,我使用 tar 命令进行解压:tar -zxvf open_oscar_server.X.XX.X.linux.x86_64.tar.gz。当然,请将 X.XX.X 替换为你下载的版本号。

Testing Open OSCAR Server

测试 Open OSCAR Server

If you’re just running this on your local machine, you can probably cd into the subdirectory it just created, and run the program. But assuming you want to run this on another machine, like I did, we have more configuration to do before we get chatting. 如果你只是在本地机器上运行,可以直接进入解压后的子目录并运行程序。但假设你想像我一样在另一台机器上运行它,在开始聊天之前,我们还需要进行更多配置。

I first went into the subdirectory with cd, and then I used my favorite text editor to edit the settings.env file. 我首先使用 cd 进入子目录,然后使用我最喜欢的文本编辑器编辑 settings.env 文件。

There’s three modes for the Open OSCAR Server to listen for clients: Open OSCAR Server 有三种监听客户端的模式:

  • LOCAL, which is the default: your AIM client is on the same machine as the server. You probably don’t want this one unless you know what you’re doing. LOCAL(默认):你的 AIM 客户端与服务器在同一台机器上。除非你很清楚自己在做什么,否则通常不需要这个模式。
  • In a LAN mode, Open OSCAR Server is on the same internal network as the AIM clients. If you’re planning on chatting between computers inside your home network, and not across the internet, that’s probably what you want. LAN 模式:Open OSCAR Server 与 AIM 客户端处于同一个内部网络。如果你打算在家庭网络内的计算机之间聊天,而不是跨互联网,这通常是你需要的。
  • Or in WAN mode, Open OSCAR Server is running across the internet from your AIM clients. If you’re planning on sharing the server with friends outside your home, that’s probably what you want. WAN 模式:Open OSCAR Server 通过互联网连接你的 AIM 客户端。如果你打算与家外的朋友分享服务器,这通常是你需要的。

For testing, I set this on two variables inside settings.env: OSCAR_LISTENERS which configures how Open OSCAR Server listens, and OSCAR_ADVERTISED_LISTENERS_PLAIN which configures the advertised listener that you should give to clients like AIM. 为了测试,我在 settings.env 中设置了两个变量:OSCAR_LISTENERS(配置 Open OSCAR Server 如何监听)和 OSCAR_ADVERTISED_LISTENERS_PLAIN(配置你应该提供给 AIM 等客户端的广播监听地址)。

In the case of the latter, you should also set this up with your IP address or domain name which you plan to give to clients. 对于后者,你应该将其设置为你打算提供给客户端的 IP 地址或域名。

So, for example, if you were sharing this publicly on a VPS with a domain at example.domain, you might set OSCAR_LISTENERS to WAN://0.0.0.0:5190 and OSCAR_ADVERTISED_LISTENERS_PLAIN to WAN://example.domain:5190. If you’re inside your network, you’d replace WAN with LAN and the example domain with whatever IP address you gave the server. 例如,如果你在 VPS 上公开分享,域名为 example.domain,你可以将 OSCAR_LISTENERS 设置为 WAN://0.0.0.0:5190,将 OSCAR_ADVERTISED_LISTENERS_PLAIN 设置为 WAN://example.domain:5190。如果你在局域网内,则将 WAN 替换为 LAN,并将示例域名替换为你分配给服务器的 IP 地址。

The config file itself explains this pretty well. The important thing is that they match, LAN and LAN or WAN and WAN or both on both. 配置文件本身对此解释得很清楚。重要的是它们必须匹配,即 LAN 对 LAN,或者 WAN 对 WAN。

After your configuration is done, you should be able to run it with ./open_oscar_server and then configure your clients. 配置完成后,你应该可以通过 ./open_oscar_server 运行它,然后配置你的客户端。

Configuring clients

配置客户端

There’s probably a thousand different clients, but the important thing is that many versions of AIM have a configuration section where you can replace the default (and defunct) login.oscar.aol.com with whatever you specified in OSCAR_ADVERTISED_LISTENERS_PLAIN. In AIM 5.1, which I am using on my machines, it’s in “Setup”, then the big “Configuration” button. 客户端可能有成千上万种,但重要的是,许多版本的 AIM 都有一个配置部分,你可以将默认的(已失效的)login.oscar.aol.com 替换为你刚才在 OSCAR_ADVERTISED_LISTENERS_PLAIN 中指定的地址。在我使用的 AIM 5.1 中,它位于“Setup”菜单,然后点击大的“Configuration”按钮。

Once you replace that URL in the settings, it should hopefully be a snap, just enter literally any screen name, literally any password, and you should hopefully get signed in. 一旦你在设置中替换了该 URL,一切应该会变得非常简单:只需输入任意用户名和任意密码,你应该就能成功登录。

Have a friend do the same. If you’re set up for LAN, they’ll have to be on your network. If you set it up WAN-wise, you’ll have to give them access through any firewalls or whatnot, but it should work! It did for me anyway! :) 让你的朋友也这样做。如果你设置的是 LAN 模式,他们必须在你的网络内。如果你设置的是 WAN 模式,你需要确保他们能通过防火墙等限制访问,但它应该能正常工作!反正我是成功了!:)

Controlling Open OSCAR Server with systemd

使用 systemd 控制 Open OSCAR Server

I’m going to get in trouble here, aren’t I? Open OSCAR ships a systemd service, which makes running the server when you aren’t SSH’d into it a piece of cake. 我又要惹麻烦了,不是吗?Open OSCAR 自带了一个 systemd 服务,这使得在你不进行 SSH 连接时也能轻松运行服务器。

The docs go into specifically how to set this up, so I don’t want to just copy/paste their words: if you want to have the server run when you aren’t connected to it, you should go do that thing. 文档中详细说明了如何设置,所以我不想只是简单地复制粘贴:如果你想在断开连接后依然保持服务器运行,你应该去按照文档操作。