Installing CUDA 12.0.0 on my server of Ubuntu 18.04

I follow the url “https://developer.nvidia.com/cuda-12-0-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=18.04&target_type=deb_local” to install CUDA 12.0.0 on my server of Ubuntu 18.04. Before installation, my server is installed with CUDA 11.1, I follow this website: “CUDA Installation Guide for Linux” to uninstall my old CUDA.

When I run the “sudo apt-get -y install cuda”, I meet a mistake, the following is the detail:
root@100cfe0127d8:~# sudo apt-get -y install cudaReading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
ca-certificates-java cuda-12-0 cuda-cccl-12-0 cuda-command-line-tools-12-0
cuda-compiler-12-0 cuda-cudart-12-0 cuda-cudart-dev-12-0 cuda-cuobjdump-12-0
cuda-cupti-12-0 cuda-cupti-dev-12-0 cuda-cuxxfilt-12-0 cuda-demo-suite-12-0
cuda-documentation-12-0 cuda-driver-dev-12-0 cuda-drivers cuda-drivers-525 cuda-gdb-12-0
cuda-libraries-12-0 cuda-libraries-dev-12-0 cuda-nsight-12-0 cuda-nsight-compute-12-0
cuda-nsight-systems-12-0 cuda-nvcc-12-0 cuda-nvdisasm-12-0 cuda-nvml-dev-12-0
cuda-nvprof-12-0 cuda-nvprune-12-0 cuda-nvrtc-12-0 cuda-nvrtc-dev-12-0 cuda-nvtx-12-0
cuda-nvvp-12-0 cuda-opencl-12-0 cuda-opencl-dev-12-0 cuda-profiler-api-12-0
cuda-runtime-12-0 cuda-sanitizer-12-0 cuda-toolkit-12-0 cuda-toolkit-12-0-config-common
cuda-toolkit-12-config-common cuda-toolkit-config-common cuda-tools-12-0
cuda-visual-tools-12-0 default-jre default-jre-headless distro-info-data dkms fakeroot
fonts-dejavu-extra gds-tools-12-0 java-common keyboard-configuration kmod libasound2
libasound2-data libatk-wrapper-java libatk-wrapper-java-jni libcublas-12-0
libcublas-dev-12-0 libcufft-12-0 libcufft-dev-12-0 libcufile-12-0 libcufile-dev-12-0
libcurand-12-0 libcurand-dev-12-0 libcusolver-12-0 libcusolver-dev-12-0 libcusparse-12-0
libcusparse-dev-12-0 libfakeroot libfontenc1 libgif7 libjansson4 liblocale-gettext-perl
libnpp-12-0 libnpp-dev-12-0 libnspr4 libnss3 libnuma1 libnvidia-cfg1-525
libnvidia-common-525 libnvidia-compute-525 libnvidia-decode-525 libnvidia-encode-525
libnvidia-extra-525 libnvidia-fbc1-525 libnvidia-gl-525 libnvjitlink-12-0
libnvjitlink-dev-12-0 libnvjpeg-12-0 libnvjpeg-dev-12-0 libnvvm-samples-12-0 libpcsclite1
libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libudev1 libvdpau1
libxcb-xinput0 libxfont2 libxft2 libxkbfile1 libxnvctrl0 libxv1 libxxf86dga1
linux-headers-4.15.0-213 linux-headers-4.15.0-213-generic linux-headers-generic
lsb-release mesa-vdpau-drivers nsight-compute-2022.4.0 nsight-systems-2022.4.2
nvidia-compute-utils-525 nvidia-dkms-525 nvidia-driver-525 nvidia-kernel-common-525
nvidia-kernel-source-525 nvidia-modprobe nvidia-prime nvidia-settings nvidia-utils-525
openjdk-11-jre openjdk-11-jre-headless policykit-1 policykit-1-gnome python3-xkit
screen-resolution-extra udev vdpau-driver-all x11-utils x11-xkb-utils xfonts-base
xfonts-encodings xfonts-utils xserver-common xserver-xorg-core-hwe-18.04
xserver-xorg-video-nvidia-525
Suggested packages:
python3-apport menu libasound2-plugins alsa-utils pcscd lsb libnss-mdns
fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei
fonts-indic libvdpau-va-gl1 nvidia-vdpau-driver nvidia-legacy-340xx-vdpau-driver
mesa-utils xfs | xserver xfonts-100dpi | xfonts-75dpi xfonts-scalable
Recommended packages:
libnvidia-compute-525:i386 libnvidia-decode-525:i386 libnvidia-encode-525:i386
libnvidia-fbc1-525:i386 libnvidia-gl-525:i386
The following NEW packages will be installed:
ca-certificates-java cuda cuda-12-0 cuda-cccl-12-0 cuda-command-line-tools-12-0
cuda-compiler-12-0 cuda-cudart-12-0 cuda-cudart-dev-12-0 cuda-cuobjdump-12-0
cuda-cupti-12-0 cuda-cupti-dev-12-0 cuda-cuxxfilt-12-0 cuda-demo-suite-12-0
cuda-documentation-12-0 cuda-driver-dev-12-0 cuda-drivers cuda-drivers-525 cuda-gdb-12-0
cuda-libraries-12-0 cuda-libraries-dev-12-0 cuda-nsight-12-0 cuda-nsight-compute-12-0
cuda-nsight-systems-12-0 cuda-nvcc-12-0 cuda-nvdisasm-12-0 cuda-nvml-dev-12-0
cuda-nvprof-12-0 cuda-nvprune-12-0 cuda-nvrtc-12-0 cuda-nvrtc-dev-12-0 cuda-nvtx-12-0
cuda-nvvp-12-0 cuda-opencl-12-0 cuda-opencl-dev-12-0 cuda-profiler-api-12-0
cuda-runtime-12-0 cuda-sanitizer-12-0 cuda-toolkit-12-0 cuda-toolkit-12-0-config-common
cuda-toolkit-12-config-common cuda-toolkit-config-common cuda-tools-12-0
cuda-visual-tools-12-0 default-jre default-jre-headless distro-info-data dkms fakeroot
fonts-dejavu-extra gds-tools-12-0 java-common keyboard-configuration kmod libasound2
libasound2-data libatk-wrapper-java libatk-wrapper-java-jni libcublas-12-0
libcublas-dev-12-0 libcufft-12-0 libcufft-dev-12-0 libcufile-12-0 libcufile-dev-12-0
libcurand-12-0 libcurand-dev-12-0 libcusolver-12-0 libcusolver-dev-12-0 libcusparse-12-0
libcusparse-dev-12-0 libfakeroot libfontenc1 libgif7 libjansson4 liblocale-gettext-perl
libnpp-12-0 libnpp-dev-12-0 libnspr4 libnss3 libnuma1 libnvidia-cfg1-525
libnvidia-common-525 libnvidia-compute-525 libnvidia-decode-525 libnvidia-encode-525
libnvidia-extra-525 libnvidia-fbc1-525 libnvidia-gl-525 libnvjitlink-12-0
libnvjitlink-dev-12-0 libnvjpeg-12-0 libnvjpeg-dev-12-0 libnvvm-samples-12-0 libpcsclite1
libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libvdpau1 libxcb-xinput0
libxfont2 libxft2 libxkbfile1 libxnvctrl0 libxv1 libxxf86dga1 linux-headers-4.15.0-213
linux-headers-4.15.0-213-generic linux-headers-generic lsb-release mesa-vdpau-drivers
nsight-compute-2022.4.0 nsight-systems-2022.4.2 nvidia-compute-utils-525 nvidia-dkms-525
nvidia-driver-525 nvidia-kernel-common-525 nvidia-kernel-source-525 nvidia-modprobe
nvidia-prime nvidia-settings nvidia-utils-525 openjdk-11-jre openjdk-11-jre-headless
policykit-1 policykit-1-gnome python3-xkit screen-resolution-extra udev vdpau-driver-all
x11-utils x11-xkb-utils xfonts-base xfonts-encodings xfonts-utils xserver-common
xserver-xorg-core-hwe-18.04 xserver-xorg-video-nvidia-525
The following packages will be upgraded:
libudev1
1 upgraded, 136 newly installed, 0 to remove and 157 not upgraded.
Need to get 67.5 MB/2980 MB of archives.
After this operation, 7749 MB of additional disk space will be used.

Get:31 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 libfontenc1 amd64 1:1.1.3-1 [13.9 kB]
Get:32 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 libxfont2 amd64 1:2.0.3-1 [91.7 kB]
Get:33 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 xserver-xorg-core-hwe-18.04 amd64 2:1.20.8-2ubuntu2.2~18.04.11 [1335 kB]
E: Method file has died unexpectedly!
E: Sub-process file received signal 9.