Step by step from Debian installation to environment building

debian Download

https://mirrors.ustc.edu.cn Image of CUHK

Install directly without: graphic install

debian garbled

When you install debian in the simplest way, because there is no Chinese character library, if you choose to look at the Chinese environment, there will be diamond code. Let's change zh.utf8 to us.utf8 first. 1,apt-get update 2,su 3,dpkg-reconfigure locales 4. space cancel options 5. Press the space bar to select the en? Us.utf8 option 6,ok

debian replace domestic source

Replace ustc of China University of science and technology https://mirrors.ustc.edu.cn/help/debian.html

Basic command

Study: https://cloud.tencent.com/developer/article/1359642?from=10680

#Many operations of sudo (Superuser do) cannot be separated from this. Sometimes it's OK to forget to write. The system will prompt you to use the administrator's operation.
sudo apt install man-db

#Now, to view the manual for the component, you can type:
man command

#For example, to view the top command's manual, type:
man top

#install
apt-get install nginx
apt install nginx 
#To update
apt update

#lookup
find / -name nginx


#edit
nano nginx.conf
vi nginx.conf
#move
mv src dest

# Change user password:
sudo passwd root

#nginx test conf file and reload
/usr/sbin/nginx  -t
/usr/sbin/nginx  -s reload

Download tool wget

apt-get install wget

SSH services

apt-get install openssh-server

SSH service is on by default after installation Manual start:

systemctl start ssh.service
#Modify configuration:
nano /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes

ifconfig not found

debian official recommendation: ip addr

sudo apt-get install net-tools
#Then look for:
find / -name ifconfig
alias ifconfig='/sbin/ifconfig'
ifconfig 

No compiler cc not found

apt-get install gcc

redis compiler reported fatal error: jemalloc/jemalloc.h: no file or directory Allocator allocator. If MALLOC is an environment variable, it will be used to create Redis.

Moreover, libc is not the default allocator, but jemalloc, because jemalloc has been proved to have fewer fragmentation problems than libc.

But if you don't have jemalloc and only libc, of course make is wrong. So add such a parameter and run the following command:

make MALLOC=libc

docker ce installation

community edition

See this for installation: https://www.cnblogs.com/heyangyi/p/8613149.html

1. View Linux system information nuame -a

My name is Debian, amd64

2. Check the name LSB [release - CS] of the Linux system distribution

It means:

1. View native information first

2. Find the matching docker ce address (it is recommended to find the domestic image (Tsinghua, 163, CUHK, etc.), which CUHK will use https://mirrors.ustc.edu.cn)

Then wget comes down

Then dpkg - I dockername installs docker ce

#docker service automatic restart settings
systemctl enable docker.service

#Basic command
#Lookup mirror
docker search imageName
#Download Image to local
docker pull imageName
docker images  				#List all mirrors
docker images rm imagename 	#delete mirror

#Container operation
#Create and start a container - d background run - p map to local port: container run port -- name container name
docker run --name containerName -d  -p 3307:3306 -p 1256:223  --restart=always  imageid #imageid image number / image name

docker ps -a 				#List all containers
docker start containerid 	#Start container stop container
docker rm containerid 		#Delete container
docker inspect containerid 	#View container details

#When running the docker container, the following parameters can be added to ensure that the container will restart automatically after each restart of the docker service:
docker run --restart=always

#If you have already started, you can use the following command:
docker update --restart=always <CONTAINER ID>


#Enter the running container and execute the bash command
docker exec -it container Id bash

Installing MariaDb

https://www.cnblogs.com/WaterGe/p/11067387.html

mkdir -p /data/mariadb/data #Create a directory as the mapping directory to the container

docker run --name mariadb3307 -p 3307:3306 -e MYSQL_ROOT_PASSWORD=1234 -v ~/data/mariadb/data:/var/lib/mysql -d mariadb
  • --Name start container set container name to mariadb

  • -p set the 3306 port of the container to map to the 3306 port of the host

  • -E MySQL? Root? Password set the environment variable database root password as the password of the input database root user

  • -v set the container directory / var/lib/mysql to map to the local directory / data/mariadb/data

  • -d run the container mariadb in the background and return the container id

maridb maps the container's internal configuration file to an external virtual machine

docker run -p 3306:3306 -v /mariadb/data:/var/lib/mysql -v /mariadb/conf/my.cnf:/etc/mysql/my.cnf -e MYSQL_ROOT_PASSWORD=123456 --name mariadb -d --restart unless-stopped docker.io/mariadb:latest

docker ps -a #See if the container is running

docker container update --restart=always container id  #Modify container to self start

#Container entry
docker exec -it container Id bash

Install rabbitmq

Reference resources: https://blog.csdn.net/myNameIssls/column/info/23166

sudo mkdir -p ~/data/rabbitmq 
# View image id
docker images  
docker run --restart=always -d --name rabbitmq -p 5672:5672 -p 15672:15672 -v ~/data/rabbitmq:/var/lib/rabbitmq  -e RABBITMQ_DEFAULT_VHOST=/  -e RABBITMQ_DEFAULT_USER=mqadmin -e RABBITMQ_DEFAULT_PASS=1 rabbitmq:management

Explain:

-d background operation container;

--Name specifies the container name;

-p specifies the port of service operation (5672: application access port; 15672: console Web port number);

-v mapping directory or file;

--Hostname hostname (an important note of RabbitMQ is that it stores data according to the so-called "node name", which is the hostname by default);

-e specifies the environment variable; (rabbitmq? Default? Vhost: default virtual machine name; rabbitmq? Default? User: default user name; rabbitmq? Default? Pass: password of default user name)

Install activmq

#lookup
docker search activemq
#The first is generally official
docker pull webcenter/activemq
#Operation example
docker run --restart=always --name activemq -d -p 61617:61616 -p 61614:61614 -p 8162:8161 -p 1883:1883  webcenter/activemq 

docker run -d --name activemq -p 61617:61616 -p 8162:8161 webcenter/activemq
#View running instances
docker ps -a

#Copy internal files of virtual machine to local
docker cp activemq:/opt/activemq/conf/activemq.xml ~/data/activemq/conf/activemq.xml
docker cp  ~/data/activemq/conf/activemq.xml activemq:/opt/activemq/conf/activemq.xml

Debian 10 installing dotnet

Before installing. NET, you need to:

  • Register Microsoft key
  • Register product repository
  • Install required dependencies

Each computer only needs to perform this operation once.

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/10/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list

Install ASP.NET Core runtime

Update the products available for installation, and then install the ASP.NET runtime. In the terminal, run the following command.

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install aspnetcore-runtime-3.1

Install. NET Core runtime

Update the products available for installation, and then install the. NET Core runtime. In the terminal, run the following command.

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-runtime-3.1
# sdk
sudo apt-get install dotnet-sdk-3.1

Mini distributed file storage

docker pull minio/minio
mkdir -p /home/minio/data
mkdir -p /home/minio/conf
docker run -p 9000:9000 --name minio \
-d --restart=always \
-e "MINIO_ACCESS_KEY=admin" \
-e "MINIO_SECRET_KEY=admin123456" \
-v /home/minio/data:/home/shared \
-v /home/minio/conf:/root/.minio \
minio/minio server /home/shared

Tags: Programming Docker sudo MariaDB RabbitMQ

Posted on Fri, 13 Mar 2020 00:07:24 -0400 by guayaquil