I keep most of my configuration stuff in a local Git repository so I can track changes and I symlink to those from where they should be so you will see commands such as
sudo ln -s ~/Documents/configs/PHP/fat-tony.local/php71.ini /opt/local/etc/php71/php.ini
If you don’t have a similar setup, just copy your configuration files to where they need to be.
I like to prepend some of the commands with
time
just for curiosity’s sake to see how long it takes.
Go to System Preferences -> Sharing and uncheck the Personal Web sharing. You will never turn Apache on/off here again.
macappstore://itunes.apple.com/app/xcode/id497799835?mt=12
Find the latest version in the Mac Dev Center. (You must have a free Apple Developer account.)
Either launch Xcode via GUI or run
sudo xcodebuild -license
Use the macOS Sierra v10.12 installer.
The installer will prepend your $PATH with the necessary /opt/local/bin:/opt/local/sbin:
As of Xcode 4.3 you need to make sure Xcode knows where to look.
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
sudo /opt/local/bin/port -v selfupdate
time sudo port install curl +ssl +http2
Maria DB Server is an enhanced, drop-in MySQL replacement and it isn’t controlled by Oracle.
One of the most popular database servers. Made by the original developers of MySQL. Guaranteed to stay open source.
time sudo port install mariadb-10.1 +openssl mariadb-10.1-server mysql_select
Percona explains these best:
Percona Toolkit for MySQL is a collection of advanced command-line tools used by Percona MySQL Support staff to perform a variety of MySQL server and system tasks that are too difficult or complex to perform manually…
time sudo port install p5.24-dbd-mysql -mysql56 +mariadb10_1 percona-toolkit
ZSH
nano ~/.zshrc
or Bash:
nano ~/.bash_profile
Add the following line
export PATH=/opt/local/lib/mariadb-10.1/bin:$PATH
MacPorts’ MariaDB/MySQL looks for my.cnf
in the standard paths as defined by MySQL
You can put this in the global spot: /etc/my.cnf
or the one specific to this install /opt/local/etc/percona/my.cnf
sudo ln -s ~/Documents/configs/MySQL/fat-tony.local/mariadb-10.1-server.my.cnf /opt/local/etc/mariadb-10.1/my.cnf
If you do not have a
my.cnf
file or don't know where to start, the Percona Configuration Wizard for MySQL will build you a good base. The my.cnf file here is for my development machine which is a MacBook Pro “Core i7” 2.7 15" Retina 2013 with 16GB of RAM.
If this is a fresh MariaDB install and you're not re-using existing data install the default tables
sudo -u _mysql /opt/local/lib/mariadb-10.1/bin/mysql_install_db
This installs and activates a launchd item.
Do not be confused by MacPorts' documentation referring to StartupItems. StartupItems is their term for special scripts that create launchd items I have no idea why they would choose terminology that makes you think it is a 10.4 (pre-launchd) StartupItem (which are deprecated).
sudo port load mariadb-10.1-server
To stop MariaDB use
sudo port unload mariadb-10.1-server
sudo /opt/local/lib/mariadb-10.1/bin/mysql_secure_installation
If you don’t set a root password when it asks you to just ring your call button, and Tommy will come back there and hit you over the head with a tack hammer because you are a retard
sudo /opt/local/lib/mariadb-10.1/bin/mysql_upgrade -uroot -p
time sudo port install nginx +geoip +gzip_static +http2 +mail +redis +ssl +zip php_select php71 php71-cgi php71-curl php71-exif php71-fpm php71-ftp php71-gd php71-geoip php71-gettext php71-iconv php71-imagick php71-imap php71-intl php71-mailparse php71-mbstring php71-mysql -mysqlnd +mariadb php71-oauth php71-opcache php71-openssl php71-posix php71-redis php71-soap php71-sockets php71-solr php71-sqlite php71-timezonedb php71-zip
If this is your development box also install Xdebug.
time sudo port install php71-xdebug
Please don’t install Xdebug on production machines!
Only really necessary if you are upgrading from an older version of PHP (Hat Tip) but doesn’t hurt to do it anyways.
sudo port select php php71
sudo ln -s ~/Documents/configs/PHP/fat-tony.local/php71.ini-development /opt/local/etc/php71/php.ini
NOTE: If you are also installing MariaDB probably need to update the
mysql.sock
paths in yourphp.ini
to reflect/opt/local/var/run/mariadb-10.1/mysqld.sock
. There are 3 possible places you may need to set this.
- mysql.default_socket
- mysqli.default_socket
- pdo_mysql.default_socket
Install Cronolog to rotate your log files
If you want to split your log files up into usable chunks.
time sudo port install cronolog
If you’re using the free GeoLite database PHP will probably not find it in the default install location.
sudo ln -s /opt/local/share/GeoIP/GeoIP.dat /opt/local/share/GeoIP/GeoIPCity.dat
sudo ln -s ~/Documents/configs/NGINX/fat-tony.local/fastcgi.conf /opt/local/etc/nginx/fastcgi.conf
sudo ln -s ~/Documents/configs/NGINX/fat-tony.local/nginx.conf /opt/local/etc/nginx/nginx.conf
sudo ln -s ~/Documents/configs/NGINX/fat-tony.local/sites-available /opt/local/etc/nginx/sites-available
sudo ln -s ~/Documents/configs/NGINX/fat-tony.local/sites-enabled /opt/local/etc/nginx/sites-enabled
sudo ln -s ~/Documents/configs/PHP/fat-tony.local/php-fpm.conf /opt/local/etc/php71/php-fpm.conf
sudo ln -s ~/Documents/configs/PHP/fat-tony.local/php-fpm.d/www.conf /opt/local/etc/php71/php-fpm.d/www.conf
sudo launchctl load -w /Library/LaunchDaemons/org.macports.php71-fpm.plist
sudo port load nginx
To stop NGINX use
sudo port unload nginx
autojump is a faster way to navigate your filesystem. It works by maintaining a database of the directories you use the most from the command line. Directories must be visited first before they can be jumped to.
time sudo port install autojump