Homebrew is installed for use
Homebrew is a software package management tool for Mac OS that makes it easy to install/uninstall software tools. Similar to APT, NPM.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy the code
Homebrew installs the tool in its own /usr/local/cellar directory and makes a symbolic link to the tool in /usr/local/bin. Common brew commands:
brew search
brew install
brew update
brew upgrade
brew uninstall
brew list
brew outdated
brew deps
brew services start/stop
Copy the code
Redis installation
## Install Redis 4.0The brew install [email protected]#Set boot up
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
#Configure the Redis environment variable
## add the following to ~ /.bash_profileThe export PATH = "/ usr/local/opt/[email protected] / bin: $PATH." " #Set environment variables to effect, executeThe source ~ /. Following#Brew start/stop RedisThe brew services start/stop at [email protected]Copy the code
Redis configuration file location: / usr/local/etc/redis. Conf
Mysql installation
#Install mysql 5.7The brew install [email protected]#Set boot upLn - SFV/usr/local/opt/[email protected] / *. Plist ~ / Library/LaunchAgents#Configure mysql environment variables
## add the following to ~/.bash_profileThe export PATH = "/ usr/local/opt/[email protected] / bin: $PATH." " #Set environment variables to effect, executeThe source ~ /. Following#Brew start/stop mysqlThe brew services start/stop at [email protected]## mysql comes with its own method
mysql.server start/stop/restart
Copy the code
Changing the Root Password
use mysql;
update user set authentication_string = password('root') where User = 'root';
flush privileges;
Copy the code
Modify character set
Check the character set
show variables where Variable_name like "character\_set\_%" or Variable_name like 'collation%';
Brew services restart [email protected] /usr/local/etc/my.cnf
# private
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[mysql]
default-character-set=utf8mb4
[client]
default-character-set=utf8mb4
Copy the code
Git installed
brew install git
#Generate a key pair
ssh-keygen -t rsa -C "[email protected]"
#Public key
cat ~/.ssh/id_rsa.pub
#Configure user information
git config --global user.name "xxx"
git config --global user.email "[email protected]"
## View user information
git config --global --get user.name
git config --global --get user.email
Copy the code
Java installation
## installation openJdk11
brew install java11
#Configure environment variablesExport JAVA_HOME = "/ usr/local/Cellar/its @ 11/11.0.10" export PATH = "$JAVA_HOME/bin: $PATH."Copy the code
Example Modify system resource limits
- ulimit
Ulimit is a built-in command of the Linux shell. It is used to limit the resources of the shell process and its subprocesses. Ulimit applies to each process, and each process has its own limits value. Changes made with ulimit take effect immediately. You can add a ulimit setting to the profile to make it permanent.
#View all Settings
ulimit -a
Copy the code
Ulimit options
- -h Sets the hardware resource limit.
- -s Sets the limitation of software resources.
- -a Displays all current resource limits.
- -c size: Sets the maximum size of core files. Unit: blocks
- -d size: Sets the maximum value of the data segment. Unit: kbytes
- -f size: Sets the maximum number of files to be created. Unit: blocks
- -l size: Sets the maximum number of locked processes in the memory. Unit: kbytes
- -m size: Sets the maximum resident memory available. Unit: kbytes
- -n size: Sets the maximum number of file descriptors that the kernel can open at the same time. Unit: n
- -p size: Sets the maximum size of the pipeline buffer. Unit: kbytes
- -s size: Sets the maximum stack size. Unit: kbytes
- -t size: Sets the maximum CPU usage time. Unit: seconds
- -v size: Sets the maximum value of the virtual memory. Unit: kbytes
- Unlimited is a special value for unlimited
Note: (1) -n limits the maximum number of file descriptors. This parameter also limits the number of socket connections. (2) Soft limit is displayed by default if H or S is not added during query; (3) During modification, if H or S is not added, the two parameters will be changed together.
- limits.conf
/ etc/security/limits file is actually a pam_limits. So the configuration files, on the user’s session of the pam_limits module resource constraints. A shell’s initial limits is set by pam_limits.
- sysctl(linux)
Sysctl is used to modify kernel parameters, and sysctl changes are immediate and temporary (reset invalid). You can modify the sysctl.conf configuration file to take effect permanently. Sysctl options
- -n Indicates that no keyword is printed when the value is printed
- -e The unknown keyword is ignored
- -n Displays only the name
- -w This parameter is used when syscTL Settings are changed
- -p Loads kernel parameter Settings from the /etc/sysctl.conf configuration file
- -a Displays all available kernel parameter variables and values
- -a Displays all available kernel parameter variables and values in A table
- launchctl(macos)
Linux has Systemd, and MacOS has a similar tool: Launchd, whose administrative counterpart is Launchctl.
## Check open file limits
launchctl limit maxfiles
## Change open file limit, restart invalid
sudo launchctl limit maxfiles 512 unlimited
#The launchctl command is written to /etc/launchd.conf
limit maxfiles 512 unlimited
Copy the code
Unlimited Indicates the upper limit of 10,240.
Note ⚠ ️ : through launchctl modify maxfiles leads to kern, maxfiles changes, sysctl -a | grep maxfiles can be observed. Maxfiles = XXX launchctl limit maxFiles cannot be detected and can be greater than 10240. After launchctl, ulimit -n is 256 in the old shell session and 2560 in the shell terminal with the heart open.
Python3 installation
The brew install [email protected]Copy the code