如何在 Ubuntu 18.04 服务器上设置 DNS(升级失败)

如何在 Ubuntu 18.04 服务器上设置 DNS(升级失败)

我的情况有点棘手。我将 Ubuntu 服务器从 16.04 升级到了 18.04,但升级过程并不顺利。现在,它在“lsb_release -a”上显示版本 18.04 LTS,并且无法安装任何软件包,因为 Apache 不想升级到 18.04 上的默认版本。

这是 Jira Server(确切地说是 v18.12)。据我所知,我无法更改 Apache 版本。现在,当我尝试安装任何软件包时,我都会得到

root@jira:/# apt-get install netplan
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 apache2 : Depends: apache2-bin (= 2.4.18-2ubuntu3.17) but 2.4.29-1ubuntu4.21 is to be installed
           Depends: apache2-data (= 2.4.18-2ubuntu3.17) but 2.4.29-1ubuntu4.21 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

apt-fix-broken 安装

命令向我展示了这一点。

root@jira:/# apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libasprintf0v5 liblua5.1-0 libxft2 libxxf86dga1 rename sgml-base xml-core
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apache2
Suggested packages:
  www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following packages will be upgraded:
  apache2
1 upgraded, 0 newly installed, 0 to remove and 263 not upgraded.
139 not fully installed or removed.
Need to get 0 B/95.1 kB of archives.
After this operation, 26.6 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 99235 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.29-1ubuntu4.21_amd64.deb ...
Restoring lost conffile /etc/apache2/mods-available/cern_meta.load.
/var/lib/dpkg/tmp.ci/preinst: line 149: /etc/apache2/mods-available/cern_meta.load: No such file or directory
dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.29-1ubuntu4.21_amd64.deb (--unpack):
 new apache2 package pre-installation script subprocess returned error exit status 1
insserv: warning: script 'K01jira' missing LSB tags and overrides
insserv: warning: script 'jira' missing LSB tags and overrides
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; generated)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Mon 2022-02-21 19:09:14 CET; 7ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 21408 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)

Feb 21 19:09:14 jira systemd[1]: Starting LSB: Apache2 web server...
Feb 21 19:09:14 jira apache2[21408]: /etc/init.d/apache2: 46: .: Can't open /etc/apache2/envvars
Feb 21 19:09:14 jira apache2[21408]: /etc/init.d/apache2: 57: .: Can't open /etc/apache2/envvars
Feb 21 19:09:14 jira apache2[21408]: ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars
Feb 21 19:09:14 jira systemd[1]: apache2.service: Control process exited, code=exited status=2
Feb 21 19:09:14 jira systemd[1]: apache2.service: Failed with result 'exit-code'.
Feb 21 19:09:14 jira systemd[1]: Failed to start LSB: Apache2 web server.
Errors were encountered while processing:
 /var/cache/apt/archives/apache2_2.4.29-1ubuntu4.21_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Jira 运行良好!问题是,服务器目前无法发送任何电子邮件通知。我无法从控制台 ping 任何地方(甚至 google.com)。我把情况缩小到我没有在该框上配置任何 DNS 服务器。并寻找一种无需安装任何软件包即可定义任何 DNS 服务器的方法。

也许有一种老式的方法来编辑配置文件并恢复互联网?

我是 Linux 新手,搜索没有找到太多信息。已经花了几个小时,决定征求你的意见。

感谢您的帮助!

相关内容