在Ubuntu上配置SQL Server的步骤如下:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/mssql-server-2022 main"
sudo apt-get update
sudo apt-get install -y mssql-server
mssql-conf setup
进行配置:sudo /opt/mssql/bin/mssql-conf setup
按照提示设置SA密码并选择版本。
sudo systemctl status mssql-server --no-pager
mssql-tools
和unixodbc-dev
:sudo apt-get install mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' | sudo tee -a /etc/profile
source /etc/profile
/etc/network/interfaces
):sudo vim /etc/network/interfaces
添加以下内容(根据实际情况修改IP地址、子网掩码、网关等):
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
sudo systemctl restart networking
或者
sudo /etc/init.d/networking restart
sudo ufw allow 1433/tcp
sudo systemctl status mssql-server --no-pager
从另一台机器上尝试使用SQL Server客户端(如SQL Server Management Studio)连接到Ubuntu机器的IP地址和配置的端口,确保网络配置正确。
请注意,以上步骤是基于Ubuntu 20.04和SQL Server 2022的配置指南。如果你使用的是不同版本的Ubuntu或SQL Server,可能需要调整命令和步骤。